示例#1
0
 /**
  * Tổng số task, thời gian bé nhất, thời gian lớn nhất cua tat ca dự án được gán cho nhân viên
  * @param type $project_id
  * @param type $accout_id
  * @param type $status
  */
 public function generalAccountProject($account_id)
 {
     $project_member = ProjectMember::model()->getProjectByMember($account_id);
     $total_task = 0;
     $start_arr = array();
     $end_arr = array();
     $i = 0;
     foreach ($project_member->data as $project_member_item) {
         $project_id = $project_member_item->project_id;
         $account_id = $project_member_item->account_id;
         if ($this->getStartTaskProject($project_id, $account_id) != "Null") {
             $start_arr[$i] = $this->getStartTaskProject($project_id, $account_id);
         }
         if ($this->getEndTaskProject($project_id, $account_id) != "Null") {
             $end_arr[$i] = $this->getEndTaskProject($project_id, $account_id);
         }
         $total_task += $this->calculateTaskOneProject($project_id, $account_id);
         $i++;
     }
     $generalAP = array();
     $generalAP['total_task'] = $total_task;
     if (count($start_arr) > 0) {
         $generalAP['start'] = min($start_arr);
     } else {
         $generalAP['start'] = 'Null';
     }
     if (count($end_arr) > 0) {
         $generalAP['end'] = max($end_arr);
     } else {
         $generalAP['end'] = 'Null';
     }
     return $generalAP;
 }
示例#2
0
 function actionAccountResourceReport($account_id)
 {
     $model = ProjectMember::model()->getProjectByMember($account_id);
     $this->render('account_resource_report', array('model' => $model, 'account_id' => $account_id));
 }
 /**
  * This action is used for an existing account who is invited to another team.
  */
 public function actionJoinTeam()
 {
     if (isset($_GET['invite_id'])) {
         $invite_id = $_GET['invite_id'];
         // get invite
         $model = $this->loadModel($invite_id);
         $model->account_invitation_status = 1;
         $model->save();
         // create team member record
         $teamMember = new AccountTeamMember();
         $teamMember->accepting_invitation = true;
         $teamMember->master_account_id = $model->account_invitation_master_id;
         $teamMember->account_subscription_id = $model->account_invitation_subscription_id;
         $teamMember->member_account_id = Yii::app()->user->id;
         $teamMember->is_active = AccountTeamMember::ACCOUNT_TEAM_MEMBER_IS_ACTIVE;
         if ($model->account_invitation_type == AccountInvitation::ACCOUNT_INVITATION_TYPE_CUSTOMER) {
             $teamMember->is_customer = ACCOUNT_TEAM_MEMBER_IS_CUSTOMER;
         } else {
             $teamMember->is_customer = 0;
         }
         if ($teamMember->save()) {
             $this->redirect(array('accountTeamMember/admin'));
         }
         if ($teamMember->save()) {
             // create project member record if any
             if ($model->account_invitation_project > 0) {
                 $projectMember = new ProjectMember();
                 $projectMember->project_id = $model->account_invitation_project;
                 $projectMember->account_id = Yii::app()->user->id;
                 $projectMember->project_member_start_date = date('Y-m-d H:i:s');
                 $projectMember->project_member_is_manager = PROJECT_MEMBER_IS_NOT_MANAGER;
                 $projectMember->accepting_invitation = true;
                 $projectMember->save();
             }
         }
     }
 }