Exemple #1
0
 public function signUp(Request $request, Response $response, $args)
 {
     $this->logger->info("SignUp page action dispatched");
     $uri = $request->getUri();
     if ($request->getMethod() == 'POST') {
         $data = $request->getParsedBody();
         $v = new $this->validator($data);
         $v->lang('es');
         $v->rule('required', array('email', 'username', 'password', 'company'));
         if ($v->validate()) {
             try {
                 $this->logger->info("Signup with parameters: " . $data['email'] . " - " . $data['username'] . " - " . $data['password'] . " - " . $data['company']);
                 $newUser = new User();
                 $newUser->setUsername($data['username']);
                 $newUser->setEmail($data['email']);
                 $newUser->setPassword($data['password']);
                 $newUser->signUp();
                 if ($newUser != null && $newUser->isAuthenticated()) {
                     $result = ParseCloud::run('addUserToRole', ['roleName' => 'Manager'], false);
                     $this->logger->info("User added to Manager Role? " . $result);
                     $company = new Company();
                     $company->setName($data['company']);
                     $company->save();
                     $this->flash->addMessage('info', 'Sample flash message');
                     return $response->withStatus(302)->withHeader('Location', $uri->withPath(''));
                 }
             } catch (ParseException $e) {
                 ParseErrorHandler::handleParseError($e);
                 $this->flash->addMessage('error', $e->getMessage());
                 return $response->withStatus(302)->withHeader('Location', $uri->withPath('signup'));
             }
         }
         foreach ($v->errors() as $field => $errors) {
             foreach ($errors as $error) {
                 $this->flash->addMessage('error', $error);
             }
         }
         return $response->withStatus(302)->withHeader('Location', $uri->withPath('signup'));
     }
     // Get Messages
     $messages = $this->flash->getMessages();
     // Fetch Template
     $body = $this->view->fetch('login/signup.twig', ['flash' => $messages]);
     // Write Response
     return $response->write($body);
 }
 public function editCompany($id)
 {
     $user_id = Session::get('user_id');
     $param['member'] = MembersModel::find($user_id);
     if ($alert = Session::get('alert')) {
         $param['alert'] = $alert;
     }
     $param['type'] = TypeModel::whereRaw(true)->orderBy('type', 'asc')->get();
     $param['people'] = PeopleModel::whereRaw(true)->orderBy('firstName', 'asc')->get();
     $param['company'] = CompanyModel::all();
     $param['companyItem'] = CompanyModel::find($id);
     return View::make('user.company.edit')->with($param);
 }
 public function listeCompagniesJapon()
 {
     $comp = new Company();
     echo $comp->companies();
 }
 public function view($id)
 {
     if ($alert = Session::get('alert')) {
         $param['alert'] = $alert;
     }
     $param['pageNo'] = 61;
     $param['people'] = PeopleModel::find($id);
     $param['selectTags'] = TagPeopleModel::whereRaw('peopleId =?', array($id))->get();
     $param['project'] = ProjectModel::whereRaw('peopleId = ?', array($id))->get();
     $param['category'] = CategoryModel::whereRaw(true)->orderBy('category', 'asc')->get();
     $param['industry'] = IndustryModel::whereRaw(true)->orderBy('industry', 'asc')->get();
     $param['tags'] = TagsModel::whereRaw(true)->orderBy('tags', 'asc')->get();
     $param['company'] = CompanyModel::whereRaw(true)->orderBy('companyName', 'asc')->get();
     $param['type'] = TypeModel::whereRaw(true)->orderBy('type', 'asc')->get();
     $param['selectTags'] = TagPeopleModel::whereRaw('peopleId =?', array($id))->get();
     $param['members'] = MembersModel::whereRaw(true)->orderBy('first_name', 'asc')->get();
     $param['project'] = ProjectModel::whereRaw('peopleId =?', array($id))->get();
     $projectIDs = ProjectModel::whereRaw('peopleId =?', array($id))->get();
     $k = 0;
     $listQuote = array();
     for ($i = 0; $i < count($projectIDs); $i++) {
         $quotes = QuoteModel::whereRaw('projectId = ?', array($projectIDs[$i]->id))->get();
         for ($j = 0; $j < count($quotes); $j++) {
             $listQuote[$k] = $quotes[$j];
             $k++;
         }
     }
     $param['listQuote'] = $listQuote;
     $param['note'] = NoteModel::whereRaw('peopleId=?', array($id))->get();
     $note = NoteModel::whereRaw('peopleId=?', array($id))->get();
     $list = "";
     for ($i = 0; $i < count($note); $i++) {
         $list .= '<div class="col-md-12 margin-bottom-10 forest-change-note-header">';
         if (strtoupper($note[$i]->noteCommType->noteCommType) == "PHONE") {
             $list .= '<div class="panel panel-blue margin-bottom-20" >';
         } else {
             if (strtoupper($note[$i]->noteCommType->noteCommType) == "EMAIL") {
                 $list .= '<div class="panel panel-green margin-bottom-20" >';
             }
         }
         if (strtoupper($note[$i]->noteCommType->noteCommType) == "PHONE") {
             $list .= '<div class="panel-heading forest-panel-heading-note" style="background: #3498db; ">';
         } else {
             if (strtoupper($note[$i]->noteCommType->noteCommType) == "EMAIL") {
                 $list .= '<div class="panel-heading forest-panel-heading-note" style="background: #2ecc71;">';
             }
         }
         $list .= '<h3 class="panel-title forest-panel-title-note">';
         if (strtoupper($note[$i]->noteCommType->noteCommType) == "PHONE") {
             $list .= '<img src="/images/Modern-Phone-icon.jpg" style="width:30px; height:30px;">';
         } else {
             if (strtoupper($note[$i]->noteCommType->noteCommType) == "EMAIL") {
                 $list .= '<img src="/images/Email.png" style="width:30px; height:30px;">';
             }
         }
         $list .= '<span>(' . ucfirst($note[$i]->noteType->notesType) . ')</span>';
         $list .= '<span>(' . substr($note[$i]->updated_at, 0, 16) . ')</span>';
         $list .= '<span>(' . ucfirst($note[$i]->noteStatus->notesStatus) . ')</span>';
         $list .= ' </h3>
                             </div>
                             <div class="panel-body">';
         $list .= $note[$i]->notes;
         $list .= ' </div>
                          </div>
                       </div>';
     }
     $param['list'] = $list;
     return View::make('admin.contact.detail')->with($param);
 }
 public function main($id)
 {
     if ($alert = Session::get('alert')) {
         $param['alert'] = $alert;
     }
     $user_id = Session::get('user_id');
     $param['member'] = MembersModel::find($user_id);
     $param['people'] = PeopleModel::find($id);
     $param['category'] = CategoryModel::whereRaw(true)->orderBy('category', 'asc')->get();
     $param['industry'] = IndustryModel::whereRaw(true)->orderBy('industry', 'asc')->get();
     $param['tags'] = TagsModel::whereRaw(true)->orderBy('tags', 'asc')->get();
     $param['company'] = CompanyModel::whereRaw(true)->orderBy('companyName', 'asc')->get();
     $param['type'] = TypeModel::whereRaw(true)->orderBy('type', 'asc')->get();
     $param['selectTags'] = TagPeopleModel::whereRaw('peopleId =?', array($id))->get();
     $param['members'] = MembersModel::whereRaw(true)->orderBy('first_name', 'asc')->get();
     /****note base*******/
     $param['noteType'] = NoteTypeModel::whereRaw(true)->orderBy('notesType', 'asc')->get();
     $param['noteCommType'] = NoteCommTypeModel::whereRaw(true)->orderBy('noteCommType', 'asc')->get();
     $param['noteAssign'] = NoteAssignModel::whereRaw(true)->orderBy('noteAssign', 'asc')->get();
     $param['noteStatus'] = NoteStatusModel::whereRaw(true)->orderBy('notesStatus', 'asc')->get();
     $param['noteTypeDetails'] = NoteTypeDetailsModel::whereRaw(true)->orderBy('noteTypeDetails', 'asc')->get();
     /****note ***/
     $param['note'] = NoteModel::whereRaw('peopleId=?', array($id))->get();
     /******Projects****/
     $param['project'] = ProjectModel::whereRaw('peopleId =?', array($id))->get();
     $projectIDs = ProjectModel::whereRaw('peopleId =?', array($id))->get();
     $k = 0;
     $listQuote = array();
     for ($i = 0; $i < count($projectIDs); $i++) {
         $quotes = QuoteModel::whereRaw('projectId = ?', array($projectIDs[$i]->id))->get();
         for ($j = 0; $j < count($quotes); $j++) {
             $listQuote[$k] = $quotes[$j];
             $k++;
         }
     }
     $param['listQuote'] = $listQuote;
     $param['pageNo'] = "4";
     $peopleId = $id;
     $note = NoteModel::whereRaw('peopleId=?', array($peopleId))->get();
     $list = "";
     for ($i = 0; $i < count($note); $i++) {
         $list .= '<div class="col-md-12 margin-bottom-10 forest-change-note-header">';
         if (strtoupper($note[$i]->noteCommType->noteCommType) == "PHONE") {
             $list .= '<div class="panel panel-blue margin-bottom-20">';
         } else {
             if (strtoupper($note[$i]->noteCommType->noteCommType) == "EMAIL") {
                 $list .= '<div class="panel panel-green margin-bottom-20">';
             }
         }
         $list .= '<div class="panel-heading forest-panel-heading-note">';
         $list .= '<h3 class="panel-title forest-panel-title-note">';
         if (strtoupper($note[$i]->noteCommType->noteCommType) == "PHONE") {
             $list .= '<img src="/images/Modern-Phone-icon.jpg" style="width:30px; height:30px;">';
         } else {
             if (strtoupper($note[$i]->noteCommType->noteCommType) == "EMAIL") {
                 $list .= '<img src="/images/Email.png" style="width:30px; height:30px;">';
             }
         }
         $list .= '<a href = "javascript:void(0)" onclick = "onEditNoteChange(' . $note[$i]->id . ')">Edit</a>';
         $list .= '<span>(' . ucfirst($note[$i]->noteType->notesType) . ')</span>';
         $list .= '<span>(' . substr($note[$i]->updated_at, 0, 16) . ')</span>';
         $list .= '<span>(' . ucfirst($note[$i]->noteStatus->notesStatus) . ')</span>';
         $list .= ' </h3>
                             </div>
                             <div class="panel-body">';
         $list .= $note[$i]->notes;
         $list .= ' </div>
                          </div>
                       </div>';
     }
     $param['list'] = $list;
     return View::make('user.contact.main')->with($param);
 }