TaskFile::find PHP Method

find() public static method

Returns array of tasks with specified ids
public static find ( array $task_ids ) : array
$task_ids array array of task ids
return array
    public static function find($task_ids)
    {
        if (!is_array($task_ids)) {
            $task_ids = array($task_ids);
        }
        $tasks = self::getAll();
        foreach ($tasks as $key => $task) {
            /**
             * @var self $task
             */
            if (!in_array($task->task_id, $task_ids)) {
                unset($tasks[$key]);
            }
        }
        return $tasks;
    }

Usage Example

Ejemplo n.º 1
0
 public function getFileURL($file)
 {
     $url = "";
     // find the file
     $afile = TaskFile::find($file->id);
     if (!$afile) {
         return "";
     }
     // get corresponding taskevent so that we can get at the event_id
     // used to segment files per event
     $taskevent = TaskEvent::find($afile->taskevents_id);
     if (!$taskevent) {
         return "";
     }
     $url = $this->aws_client->getObjectUrl($this->aws_config['bucket'], "files/events/{$taskevent->events_id}/" . $afile->path, '+60 minutes', array('ResponseContentDisposition' => 'attachment; filename=' . $afile->original_filename, 'ResponseContentType' => 'application/octet-stream'));
     return $url;
 }