/** * A custom method within the Plugin to generate the content * * @return string : HTML */ function generateTimesheetBlock() { $output = ''; $do_project_block = new Project(); $do_project_rel = new ProjectSharing(); $all_users = $do_project_rel->getAllUsersFromProjectRel(); $do_user_tab = new User(); $users_array = array(); if (is_array($all_users) && count($all_users) > 0) { foreach ($all_users as $users) { $users_array[] = $users["iduser"]; $users_array[] = $users["idcoworker"]; } $users_array = array_unique($users_array); //$users_array = array_pop($users_array,$_SESSION['do_User']->iduser); $do_prob_dis_tab = new TimesheetBlockProjectDiscuss(); $do_prob_dis_tab->getAllProjectHoursForCoWorker($users_array); if ($do_prob_dis_tab->getNumRows() > 0) { $tot_hr = 0; $used_project = array(); $result_array = array(); while ($do_prob_dis_tab->next()) { if (!in_array($do_prob_dis_tab->idproject, $used_project)) { $user_data_array = array(); $used_project[] = $do_prob_dis_tab->idproject; } //$data = array("project_name"=>$do_prob_dis_tab->name,"iduser"=>$do_prob_dis_tab->iduser,"hours"=>$do_prob_dis_tab->hours_work); $data = array("hours" => $do_prob_dis_tab->hours_work); //$result_array[$do_prob_dis_tab->idproject][$do_prob_dis_tab->name][$do_prob_dis_tab->iduser][] = $data ; $result_array[$do_prob_dis_tab->iduser][] = $data; } foreach ($result_array as $key => $value) { $output .= '<hr>'; $output .= '<b>' . $do_user_tab->getFullName($key) . '</b><br />'; $tot_hour = 0.0; foreach ($value as $hour) { $h = (double) $hour["hours"]; $tot_hour += $h; } $output .= $tot_hour . ' hrs <br />'; $tot_hour = 0.0; } $output .= '<hr>'; return $output; } else { $this->setIsActive(false); } } else { $this->setIsActive(false); } }
/** * Add the note to the workfeed from drop box email * Select all other Co-Worker on the project and push the note to them. * Every Co-Worker in the project get the feed except the one posting the note. * @param EventControler object */ function AddProjectDiscussFeedFromDropBox($idproject_task, $discuss, $iduser, $idproject_discuss, $idproject) { $this->idproject_task = $idproject_task; $this->discuss = $discuss; $this->iduser = $iduser; $this->idproject_discuss = $idproject_discuss; $this->idproject = $idproject; $do_project = new Project(); $do_project->getId($this->idproject); $this->project_name = $do_project->getProjectName(); $user = new User(); $user->getId($this->iduser); $this->user_full_name = $user->getFullName(); $do_contact = new Contact(); $do_contact->getContactPictureDetails($this->iduser); if ($do_contact->getNumRows()) { while ($do_contact->next()) { $co_workers[] = $do_->idcoworker; $this->user_picture = $do_contact->picture; $this->contact_id = $do_contact->idcontact; } } $do_proj_task_feed = new ProjectTask(); $do_proj_task_feed->getProjectTaskDetails($this->idproject_task); $this->task_description = $do_proj_task_feed->task_description; if (strlen($this->discuss) > 200) { $this->discuss = substr($this->discuss, 0, 200); $this->more = True; } else { $this->more = False; } $do_project_sharing = new ProjectSharing(); $project_users = $do_project_sharing->getCoWorkersAsArray($do_project); $project_users[] = $do_project->getProjectOwner(); $users = array(); foreach ($project_users as $project_user) { if ($iduser != $project_user) { $users[] = $project_user; } } $this->addFeed($users); }
/** * Add the note to the workfeed * Select all other Co-Worker on the project and push the note to them. * Every Co-Worker in the project get the feed except the one posting the note. * @param EventControler object */ function eventAddFeed(EventControler $evtcl) { $prefix_note = $evtcl->block_unblock_flag == "Block" ? "<b>Task Block </b>" : "<b>Task Unblock </b>"; $this->idproject_task = $evtcl->ofuz_idprojecttask; $this->discuss = $prefix_note . $evtcl->block_unblock_reason; $this->iduser = $_SESSION['do_User']->iduser; $this->idproject_discuss = $evtcl->idproject_discuss; $this->idproject = $_SESSION['do_project_task']->idproject; $this->block_unblock_flag = $evtcl->block_unblock_flag; $do_project = new Project(); $do_project->getId($this->idproject); $this->project_name = $do_project->getProjectName(); $user = new User(); $user->getId($this->iduser); $this->user_full_name = $user->getFullName(); $do_contact = new Contact(); $do_contact->getContactPictureDetails($this->iduser); if ($do_contact->getNumRows()) { while ($do_contact->next()) { $this->user_picture = $do_contact->picture; $this->contact_id = $do_contact->idcontact; } } $do_proj_task_feed = new ProjectTask(); $do_proj_task_feed->getProjectTaskDetails($this->idproject_task); $this->task_description = $do_proj_task_feed->task_description; if (strlen($this->discuss) > 200) { $this->discuss = substr($this->discuss, 0, 200); $this->more = True; } else { $this->more = False; } $do_project_sharing = new ProjectSharing(); $project_users = $do_project_sharing->getCoWorkersAsArray($do_project); $project_users[] = $do_project->getProjectOwner(); $users = array(); foreach ($project_users as $project_user) { if ($_SESSION['do_User']->iduser != $project_user) { $users[] = $project_user; } } $this->addFeed($users); }
/** * Add the Project note to the wrokfeed from the drop box mail. * Will do the similar steps as it does for adding new project note * @param User id, Projecttask id, Project id, task id, task descrpition */ function eventaddFeedFromDropbox($iduser, $idproject_task, $idproject, $idtask, $task_description) { $do_project = new Project(); $do_project->getId($idproject); $this->project_name = $do_project->getProjectName($idproject); $do_project_sharing = new ProjectSharing(); $project_users = $do_project_sharing->getCoWorkersAsArray($do_project); $project_users[] = $do_project->getProjectOwner(); $users = array(); foreach ($project_users as $project_user) { if ($iduser != $project_user) { $users[] = $project_user; } } $do_user = new User(); $this->user_full_name = $do_user->getFullName($iduser); $this->iduser = $iduser; $this->idproject_task = $idproject_task; $this->idtask = $idtask; $this->idproject = $idproject; $this->task_description = $task_description; $this->task_event_type = 'new_task_add'; $this->addFeed($users); }