Пример #1
0
 public function assignAdministrators($recordId)
 {
     if (post('Project[assign]') != '') {
         $administratorsList = explode(",", post('Project[assign]'));
         foreach ($administratorsList as $administratorsAssigned) {
             $assign = new Assign();
             $assign->user_id = $administratorsAssigned;
             $assign->project_id = $recordId;
             $assign->save();
         }
     }
 }
Пример #2
0
 public static function checkAssigned($userId, $projectId)
 {
     $checkAssign = Assign::where('user_id', '=', $userId)->where('project_id', '=', $projectId);
     if ($checkAssign->count() >= 1) {
         return TRUE;
     }
 }
Пример #3
0
 public function update($id)
 {
     $query = Project::where('id', '=', $id)->get();
     foreach ($query as $fetch) {
         $this->vars['user_id'] = $fetch->user_id;
         $this->vars['myId'] = BackendAuth::getUser()->id;
         $this->vars['isAssigned'] = Assign::checkAssigned(BackendAuth::getUser()->id, $fetch->id);
     }
     $this->getClassExtension('Backend.Behaviors.FormController')->update($id);
 }
Пример #4
0
 public function prepareVars()
 {
     $this->vars['name'] = $this->formField->getName();
     $this->vars['value'] = $this->model->{$this->columnName};
     $this->vars['myID'] = BackendAuth::getUser()->id;
     $this->vars['users'] = User::all();
     $project = new Projects();
     if (isset($project->params[0])) {
         $this->vars['projectAssign'] = Assign::where('project_id', '=', $project->params[0]);
     }
     $this->vars['getInfo'] = new User();
 }
Пример #5
0
 public function index_onDelete()
 {
     if (($checkedIds = post('checked')) && is_array($checkedIds) && count($checkedIds)) {
         foreach ($checkedIds as $projectId) {
             if (!($project = Project::find($projectId))) {
                 continue;
             }
             Assign::where('project_id', $projectId)->delete();
             $project->delete();
         }
         Flash::success('The selected projects has been deleted successfully.');
     }
     return $this->listRefresh();
 }