/**
  * Task has been assigned to the user
  *
  * @param ProjectTask $task
  * @return boolean
  * @throws NotifierConnectionError
  */
 function taskAssigned(ProjectTask $task)
 {
     if ($task->isCompleted()) {
         return true;
         // task has been already completed...
     }
     // if
     if (!$task->getAssignedTo() instanceof User) {
         return true;
         // not assigned to user
     }
     // if
     /* Checks for assigned to user, to call SMS API */
     if ($task->getAssignedTo() instanceof User) {
         $user = $task->getAssignedTo();
         $phone_num = Users::getPhoneNumberCustomProperty($user->getObjectId());
         $sms_obj = new SmsController();
         $sms_obj->prepareAssignSms($user->getDisplayName(), $task->getTitle(), get_class($task));
         $sms_obj->sendSms($phone_num);
     } else {
         if ($task->getAssignedTo() instanceof Company) {
             // Skipping implementation until business requirement is clear
         }
     }
     // GET WS COLOR
     $workspace_color = $task->getWorkspaceColorsCSV(logged_user()->getWorkspacesQuery());
     tpl_assign('task_assigned', $task);
     tpl_assign('workspace_color', $workspace_color);
     $locale = $task->getAssignedTo()->getLocale();
     Localization::instance()->loadSettings($locale, ROOT . '/language');
     if ($task->getDueDate() instanceof DateTimeValue) {
         $date = Localization::instance()->formatDescriptiveDate($task->getDueDate(), $task->getAssignedTo()->getTimezone());
         tpl_assign('date', $date);
     }
     self::queueEmail(array(self::prepareEmailAddress($task->getAssignedTo()->getEmail(), $task->getAssignedTo()->getDisplayName())), self::prepareEmailAddress($task->getUpdatedBy()->getEmail(), $task->getUpdatedByDisplayName()), lang('task assigned to you', $task->getTitle(), $task->getProject() instanceof Project ? $task->getProject()->getName() : ''), tpl_fetch(get_template_path('task_assigned', 'notifier')));
     // send
     $locale = logged_user() instanceof User ? logged_user()->getLocale() : DEFAULT_LOCALIZATION;
     Localization::instance()->loadSettings($locale, ROOT . '/language');
 }
Example #2
0
 } else {
     if ($end_of_task) {
         $tip_title = lang('end of task');
         $ico = "ico-task-end";
         $tip_pre = 'end_';
     } else {
         $tip_title = lang('start of task');
         $ico = "ico-task-start";
         $tip_pre = 'st_';
     }
 }
 $count++;
 if ($count <= 3) {
     $ws_color = $task->getObjectColor($task instanceof ProjectEvent ? 1 : 12);
     cal_get_ws_color($ws_color, $ws_style, $ws_class, $txt_color, $border_color);
     $cal_text = clean($task->getTitle());
     if (function_exists('mb_strlen')) {
         $cal_text = mb_strlen($cal_text) < $to_show_len ? $cal_text : mb_substr($cal_text, 0, $to_show_len - 3) . "...";
     } else {
         $cal_text = strlen($cal_text) < $to_show_len ? $cal_text : substr($cal_text, 0, $to_show_len - 3) . "...";
     }
     $output .= "<div class='nobr og-wsname-color-{$ws_color}' style='border-radius:4px;height:17px;margin:1px;padding:1px;z-index:1000;border: 1px solid;border-color:{$border_color}'>";
     $output .= "<span id='o_ta_div_{$tip_pre}" . $task->getId() . "'>";
     $output .= "<a class=\"internalLink link-ico {$ico}\" style='vertical-align:bottom;' href='" . $task->getViewUrl() . "' onclick=\"og.disableEventPropagation(event);\" >";
     $output .= $cal_text . "</a>";
     $output .= '</span>';
     $output .= "</div>";
     $tip_text = str_replace("\r", '', lang('assigned to') . ': ' . clean($task->getAssignedToName()) . (trim(clean($task->getText())) == '' ? '' : '<br><br>' . clean(html_to_text($task->getText()))));
     $tip_text = str_replace("\n", '<br>', $tip_text);
     if (strlen_utf($tip_text) > 200) {
         $tip_text = substr_utf($tip_text, 0, strpos($tip_text, ' ', 200)) . ' ...';
 /**
  * Returns an unsaved copy of the task. Copies everything except open/closed state,
  * anything that needs the task to have an id (like tags, properties, subtask),
  * administrative info like who created the task and when, etc.
  *
  * @param ProjectTask $task
  * @return ProjectTask
  */
 function createTaskCopy(ProjectTask $task)
 {
     $new = new ProjectTask();
     $new->setMilestoneId($task->getMilestoneId());
     $new->setParentId($task->getParentId());
     $new->setTitle($task->getTitle());
     $new->setAssignedToCompanyId($task->getAssignedToCompanyId());
     $new->setAssignedToUserId($task->getAssignedToUserId());
     $new->setPriority($task->getPriority());
     $new->setTimeEstimate($task->getTimeEstimate());
     $new->setText($task->getText());
     $new->setIsPrivate($task->getIsPrivate());
     $new->setOrder(ProjectTasks::maxOrder($new->getParentId(), $new->getMilestoneId()));
     $new->setStartDate($task->getStartDate());
     $new->setDueDate($task->getDueDate());
     return $new;
 }