/** * @brief Send an email while creating and assigning a task * @param Title of the task * @param Task description * @param Project ID to which the task belongs * @param To whom the task is assigned * @param Deadline for completing the task */ public static function sendTaskCreationMail($title, $desc, $pid, $member, $deadline) { try { $subject = 'You are assigned a task \'' . $title . '\''; $message = 'Hello ' . $member . ','; $message .= '<br /><p style="text-indent: 50px;" >'; $message .= 'You are assigned to the task \'' . $title . '\' under the project \'' . OC_Collaboration_Project::getProjectTitle($pid) . '\'.'; $message .= '<br /><p style="text-align: justify;" ><span style="font-weight: bold;" >'; $message .= 'Description: '; $message .= '</span>' . $desc . '<br /><br /><span style="font-weight: bold;" >'; $message .= 'Deadline: '; $message .= '</span>' . $deadline . '</p><br /><br />'; $message .= 'For further details, logon to your owncloud account.'; $message .= '<br /><br />'; \OC_Mail::send(OC_Preferences::getValue($member, 'settings', 'email'), $member, $subject, $message, OC_Config::getValue('mail_smtpname', ''), 'Owncloud Collaboration App', true); } catch (\Exception $e) { OC_Log::write('collaboration', __METHOD__ . ', Exception: ' . $e->getMessage(), OCP\Util::DEBUG); return false; } }
<?php p($l->t('Skillset')); ?> </h1> <table id="skills"> <tr> <th> <?php p($l->t('Member')); ?> </th> <th> <?php print_unescaped($l->t('Number of tasks in project<br />\'%s\'', array(OC_Collaboration_Project::getProjectTitle($_['project'])))); ?> </th> <th> <?php p($l->t('Number of tasks in all projects')); ?> </th> <th> <?php p($l->t('Skill')); ?> </th>
/** * @brief Unassign all the tasks performed by the given member * @param Member whose tasks have to be unassigned * @param Project ID * @param Member who removes the other member * @param Whether the calling method has already initiated the (database) transaction */ public static function unassignMembersTasks($member, $pid, $remover, $inTransaction) { try { if (!$inTransaction) { OCP\DB::beginTransaction(); } $query = \OCP\DB::prepare('SELECT `tstatus`.`tid`, `task`.`title` FROM `*PREFIX*collaboration_task_status` AS tstatus, `*PREFIX*collaboration_task` AS task, `*PREFIX*collaboration_project` AS project WHERE ' . (is_null($pid) ? '' : ' `project`.`pid`=? AND ') . '`project`.`completed`=false AND `tstatus`.`tid`=`task`.`tid` AND `task`.`pid`=`project`.`pid` AND (`status`=\'In Progress\' OR `status`=\'Held\') AND `member`=? AND `tstatus`.`last_updated_time`= (SELECT MAX(`last_updated_time`) FROM `*PREFIX*collaboration_task_status` WHERE `tid`=`tstatus`.`tid`)'); $args = array(); if (is_null($pid)) { $args[0] = $member; } else { $args[0] = $pid; $args[1] = $member; } $result = $query->execute($args); $reason = 'User removed from ' . (is_null($pid) ? 'owncloud' : OC_Collaboration_Project::getProjectTitle($pid)); while ($row = $result->fetchRow()) { self::changeStatus($row['tid'], $row['title'], 'Unassigned', $remover, NULL, $reason, true); } if (!$inTransaction) { OCP\DB::commit(); } } catch (\Exception $e) { OC_Log::write('collaboration', __METHOD__ . ', Exception: ' . $e->getMessage(), OCP\Util::DEBUG); return false; } }