private static function _PrepareManyTechnicianObjects($dataPost)
 {
     $technicians = array();
     $technician_names = \Applications\PMTool\Helpers\CommonHelper::StringToArray("\n", $dataPost["names"]);
     foreach ($technician_names as $name) {
         $technician = new \Applications\PMTool\Models\Dao\Technician();
         $technician->setPm_id($dataPost["pm_id"]);
         $technician->setTechnician_name($name);
         $technician->setTechnician_active($dataPost["active"]);
         array_push($technicians, $technician);
     }
     return $technicians;
 }
Ejemplo n.º 2
0
 public static function PrepareTechnicianObject($dataPost, $oldObject = null)
 {
     if (!is_null($oldObject)) {
         $technician = $oldObject;
     } else {
         $technician = new \Applications\PMTool\Models\Dao\Technician();
     }
     $technician->setTechnician_id($dataPost["technician_id"]);
     $technician->setTechnician_name($dataPost["technician_name"]);
     $technician->setTechnician_phone(!array_key_exists('technician_phone', $dataPost) ? "" : $dataPost["technician_phone"]);
     $technician->setTechnician_active(!array_key_exists('technician_active', $dataPost) ? "" : $dataPost["technician_active"]);
     return $technician;
 }
Ejemplo n.º 3
0
 public function executeGetItem(\Library\HttpRequest $rq)
 {
     $result = $this->InitResponseWS();
     $userId = $this->dataPost["user_id"];
     $users = \Applications\PMTool\Helpers\UserHelper::GetAndStoreUsersInSession($this);
     $user = $result['user'] = \Applications\PMTool\Helpers\CommonHelper::FindObjectByIntValue(intval($userId), 'user_id', $users);
     if ($user instanceof \Applications\PMTool\Models\Dao\User) {
         if ($user->user_type() == "pm_id") {
             $pm = new \Applications\PMTool\Models\Dao\Project_manager();
             $pm->setPm_id($user->user_value());
             $manager = $this->managers->getManagerOf('Pm');
             $pms = $manager->selectMany($pm, 'pm_id');
             $pm = $pms[0];
             $result['pm'] = $pm;
         } else {
             if ($user->user_type() == "technician_id") {
                 $technician = new \Applications\PMTool\Models\Dao\Technician();
                 $technician->setTechnician_id($user->user_value());
                 $manager = $this->managers->getManagerOf('Technician');
                 $technicians = $manager->selectMany($technician, 'technician_id');
                 $technician = $technicians[0];
                 $result['technician'] = $technician;
             }
         }
     } else {
         $result['user'] = array();
     }
     $this->SendResponseWS($result, array("resx_file" => \Applications\PMTool\Resources\Enums\ResxFileNameKeys::User, "resx_key" => $this->action(), "step" => count($result['user']) ? "success" : "error"));
 }