public static function handle_routes($app)
 {
     $app->get('/contacts', function () {
         $model = new ContactModel();
         $contacts = !$type ? $model->get_contacts() : $model->get_contacts($type);
         echo json_encode($contacts);
     });
     $app->get('/contacts/:type', function ($type) {
         $model = new ContactModel();
         $contacts = !$type ? $model->get_contacts() : $model->get_contacts($type);
         echo json_encode($contacts);
     });
     $app->get('/contact/:id', function ($id) {
         $model = new ContactModel();
         $contact = $model->get_contact($id);
         echo json_encode($contact);
     });
     $app->get('/like/contacts/:param', function ($param) {
         $model = new ContactModel();
         $contacts = $model->like_contacts($param);
         echo json_encode($contacts);
     });
     $app->get('/like/company/:param', function ($param) {
         $model = new CompanyModel();
         $companies = $model->like_companies($param);
         echo json_encode($companies);
     });
 }
 private function getFormData($cdrequest = "0")
 {
     // Busca todos os Postos de Coleta.
     $companyModel = new CompanyModel();
     $this->view->companyData = $companyModel->fetchAll(null, 'company.nmcompany');
     // Busca todos os Setores.
     $departmentModel = new DepartmentModel();
     $this->view->departmentData = $departmentModel->fetchAll(null, 'department.nmdepartment');
 }
 public function loginAction()
 {
     $request = $this->getRequest();
     $user = $request->getParam('login_user');
     $password = $request->getParam('login_password');
     if ($user != '' && $password != '') {
         $password = md5($request->getParam('login_password'));
         $auth = new Zend_Auth_Adapter_DbTable(Zend_Db_Table::getDefaultAdapter());
         $auth->setIdentityColumn('idusergslab');
         $auth->setCredentialColumn('nmpassword');
         $auth->setTableName('usergslab');
         $auth->setIdentity($user);
         $auth->setCredential($password);
         if (!Zend_Auth::getInstance()->authenticate($auth)->isValid()) {
             // Quando usuário ou senha inválidos...
             $this->_redirect('/login/index/error/true');
         } else {
             // Se usuário e senha válidos.
             $userModel = new UserModel();
             $companyModel = new CompanyModel();
             $userData = $userModel->fetchRow($userModel->getUserByCompany($user, $request->getParam('company')));
             $companyData = $companyModel->fetchRow("cdcompany = " . $request->getParam('company'));
             if (!$userData || $userData['fgactive'] != 1 || $companyData['fgactive'] != 1) {
                 Zend_Session::destroy(true);
                 $this->_redirect('/login/index/error/lab');
                 die;
             }
             $userSess = new stdClass();
             $userSess->cdusergslab = $userData->cdusergslab;
             $userSess->cdrole = $userData->cdrole;
             $userSess->cddepartment = $userData->cddepartment;
             $userSess->cddepartmentsupervisor = $userData->cddepartmentsupervisor;
             $userSess->idusergslab = $userData->idusergslab;
             $userSess->nmusergslab = $userData->nmusergslab;
             $userSess->nmmail = $userData->nmmail;
             $userSess->idrg = $userData->idrg;
             $userSess->idcpf = $userData->idcpf;
             $userSess->nmpassword = $userData->nmpassword;
             $userSess->nmuserimage = $userData->nmuserimage;
             $userSess->nmcompanylogo = $companyData->nmcompanylogo;
             $userSess->cdcompany = $companyData->cdcompany;
             $userSess->nmcompany = $companyData->nmcompany;
             $this->setSessionData("user", null, $userSess);
             $layout = Zend_Layout::getMvcInstance();
             $view = $layout->getView();
             $view->nmuserimage = $userData->nmuserimage;
             $data = $auth->getResultRowObject(null);
             Zend_Auth::getInstance()->getStorage()->write($data);
             $identity = Zend_Auth::getInstance()->getIdentity();
             $this->_redirect('/');
         }
     } else {
         $this->_redirect($this->baseUrl);
     }
 }
 public function delete($id)
 {
     $this->db->start_transaction();
     # delete company related by city
     $company = new CompanyModel();
     $company->delete_by_location($id);
     # remove the city itself
     $condition = array(CityModel::$primary_key => $id);
     $this->db->delete(CityModel::$table_name, $condition);
     $this->db->complete_transaction();
     return $this->db->transaction_status();
 }
 public function delete($id)
 {
     $this->db->trans_start();
     # delete company related by field
     $this->load->model("CompanyModel");
     $company = new CompanyModel();
     $company->delete_by_field($id);
     # remove the field itself
     $condition = array(CompanyFieldModel::$primary_key => $id);
     $this->db->delete(CompanyFieldModel::$table_name, $condition);
     $this->db->trans_complete();
     return $this->db->trans_status();
 }
 private function getFormData($cdrequest = "0")
 {
     /* Usado para a edição de uma requisição
              * Remover quando criar a tela de controle de requisição
              * Maikon.Deletar
              *
               if($cdrequest > 0)
               {
               $requestModel = new RequestModel();
               $requestData = $requestModel->fetchRow($requestModel->getRequestByCdRequest($cdrequest));
               $this->view->cdrequest = $requestData->cdrequest;
               $this->view->cdclient = $requestData->cdclient;
               $this->view->cdcovenant = $requestData->cdcovenant;
               $this->view->cdforward = $requestData->cdforward;
               $this->view->idcovenantcard = $requestData->idcovenantcard;
               $this->view->fgpriority = $requestData->fgpriority;
               //$this->view->fgcollection = $requestData->fgcollection;
               // Completar aqui com as novas colunas da tabela 'request'
     
               // Tratar variável de data vinda do banco para colocar no formulário
               $dtrequestdb = $requestData->dtrequest;
               $date = new Zend_Date($dtrequestdb, 'YYYY-MM-dd HH:mm:ss');
               $dtrequest = $date->toString('dd-MM-YYYY');
               $hrrequest = $date->toString('HH:mm:ss');
               $this->view->dtrequest = $dtrequest;
               $this->view->hrrequest = $hrrequest;
     
               //die("feshow, cdrequest: " . $cdrequest .", cdclient: ". $requestData->cdclient .", dtbirth: ". $requestData->dtbirth .", nrage: ". $this->view->nrage);
               }
              *
              *
              *  public function getPatientSituationCdRequest($cdrequest) {               ///////
               $select = $this->select()
               ->from("request")
               ->join("client", "request.cdclient = client.cdclient")   //faz a união das tabelas
               ->where("client.cdclient = ?", $cdrequest)  //apresenta os parametros
               ->setIntegrityCheck(false);
               echo $select;die;
               return $select;
               }
              */
     // Busca todos os Clientes/Pacientes, Ativos e Inativos.
     $clientModel = new ClientModel();
     $this->view->clientData = $clientModel->fetchAll(null, array('client.cdclient', 'client.nmclient'));
     // Busca todas as empresas, Ativas e Inativas.
     $companyModel = new CompanyModel();
     $this->view->companyData = $companyModel->fetchAll(null, 'company.nmcompany');
     // Busca apenas Exames Ativos(fgactive = 1)
     $examinationModel = new ExaminationModel();
     $this->view->examinationData = $examinationModel->fetchAll('examination.fgactive = 1', 'examination.nmexamination');
 }
 public function indexAction()
 {
     $covenantModel = new CovenantModel();
     $selectCovenant = $covenantModel->fetchAll();
     $company = new CompanyModel();
     $selectCompany = $company->fetchAll('cdcompanyparent IS NULL');
     $_SESSION['cdbilling'] = '';
     $departmentModel = new DepartmentModel();
     $selectDepartment = $departmentModel->fetchAll();
     $clientModel = new ClientModel();
     $clientData = $clientModel->fetchAll();
     $this->view->selectCovenant = $selectCovenant;
     $this->view->selectCompany = $selectCompany;
     $this->view->selectDepartment = $selectDepartment;
     $this->view->clientData = $clientData;
 }
Example #8
0
 public function start()
 {
     $id = intval(Request::GetPart(0, User::company()));
     if ($id == 0) {
         $id = User::company();
     }
     $this->company = CompanyModel::GetObj()->id($id);
     if ($this->company->id == 0) {
         Site::Message('Профиль не найден');
         $this->Route();
     } elseif ($this->company->id != User::company() and !User::admin()) {
         Site::Message('У Вас недостаточно прав для редактирования данного профиля');
         $this->Route();
     } else {
         switch (Request::GetPart(2, '')) {
             case 'edit':
                 $this->EditAction();
                 break;
             case 'delete':
                 $this->DeleteAction();
                 break;
             default:
                 break;
         }
     }
 }
Example #9
0
 public function __construct()
 {
     parent::__construct();
     $companyModel = new CompanyModel();
     $selectCompany = $companyModel->fetchAll();
     $arraycompany = array();
     $arraycompany['0'] = "Selecione";
     foreach ($selectCompany as $selCp) {
         $arraycompany[$selCp->cdcompany] = $selCp->nmcompany;
     }
     $departmentModel = new DepartmentModel();
     $selectDepartment = $departmentModel->fetchAll();
     $arraydepartment = array();
     $arraydepartment['0'] = "Selecione";
     foreach ($selectDepartment as $selDp) {
         $arraydepartment[$selDp->cddepartment] = $selDp->nmdepartment;
     }
     //Form Dados de Cadastro
     $this->_cdcashdesk = new Zend_Form_Element_Hidden('cdcashdesk');
     $this->_cdcashdesk->setAttrib("id", "cashdesk_cdcashdesk");
     $this->_idcashdesk = new Zend_Form_Element_Text('_idcashdesk');
     $this->_idcashdesk->setAttrib("id", "cashdesk_idcashdesk");
     $this->_idcashdesk->setLabel("Cód. Guichê  *");
     $this->_idcashdesk->setDecorators($this->_decoratorsDefault);
     $this->_idcashdesk->setRequired(true);
     $this->_nmcashdesk = new Zend_Form_Element_Text('nmcashdesk');
     $this->_nmcashdesk->setAttrib("id", "cashdesk_nmcashdesk");
     $this->_nmcashdesk->setLabel("Nome/Descrição do Guichê de Atendimento *");
     $this->_nmcashdesk->setDecorators($this->_decoratorsDefault);
     $this->_nmcashdesk->setRequired(false);
     $this->_branch = new Zend_Form_Element_Select('branch');
     $this->_branch->setAttrib("id", "cashdesk_branch");
     $this->_branch->setAttrib("class", "multiple_select");
     $this->_branch->setMultiOptions($arraycompany);
     $this->_branch->setLabel("Filial/Posto de Coleta *");
     $this->_branch->setDecorators($this->_decoratorsDefault);
     $this->_branch->setRegisterInArrayValidator(true);
     $this->_branch->setRequired(true);
     $this->_department = new Zend_Form_Element_Select('department');
     $this->_department->setAttrib("id", "cashdesk_department");
     $this->_department->setAttrib("class", "multiple_select");
     $this->_department->setMultiOptions($arraydepartment);
     $this->_department->setLabel("Setor *");
     $this->_department->setDecorators($this->_decoratorsDefault);
     $this->_department->setRegisterInArrayValidator(true);
     $this->_department->setRequired(true);
 }
Example #10
0
 public function getFormCadastre()
 {
     $departmentModel = new DepartmentModel();
     $departmentData = $departmentModel->fetchAll($departmentModel->getAllActiveDepartment());
     $roleModel = new RoleModel();
     $roleData = $roleModel->fetchAll($roleModel->select());
     $departmentSupervisorModel = new DepartmentsupervisorModel();
     $departmentSupervisorData = $departmentSupervisorModel->fetchAll($departmentSupervisorModel->getAllSupervisor());
     $companyModel = new CompanyModel();
     $companyData = $companyModel->fetchAll();
     $Arraycompany = array();
     $Arraycompany['0'] = 'Selecione';
     foreach ($companyData as $company) {
         $Arraycompany[$company->cdcompany] = $company->nmfantasyname;
     }
     $this->_nmagenda = new Zend_Form_Element_Text('nmagenda');
     $this->_nmagenda->setLabel("Nome da Agenda");
     $this->_nmagenda->setRequired(true);
     $this->_nmagenda->setDecorators($this->_decoratorsRequired);
     $this->_nmagenda->setAttrib("id", "agenda_nmagendas");
     $this->_nmagenda->setAttrib("class", "alpha nameagenda");
     $this->_nmagenda->setRequired(true);
     $this->_cdcompany = new Zend_Form_Element_Select('cdcompany');
     $this->_cdcompany->setRegisterInArrayValidator(false);
     $this->_cdcompany->addMultiOptions($Arraycompany);
     $this->_cdcompany->setLabel("Empresa");
     $this->_cdcompany->setDecorators($this->_decoratorsRequired);
     $this->_cdcompany->setAttrib("id", "user_cdcompany");
     $this->_cdcompany->setAttrib("class", "alpha");
     $this->_cdcompany->setRequired(true);
     $this->_cdphysicallocation = new Zend_Form_Element_Select('cdphysicallocation');
     $this->_cdphysicallocation->setRegisterInArrayValidator(false);
     $this->_cdphysicallocation->setLabel("Localização Física");
     $this->_cdphysicallocation->addMultiOptions(array('0' => 'Selecione'));
     $this->_cdphysicallocation->setDecorators($this->_decoratorsRequired);
     $this->_cdphysicallocation->setAttrib("id", "company_physicallocation");
     $this->_cdphysicallocation->setAttrib("class", "alpha");
     $this->_cdphysicallocation->setRequired(true);
     $this->_gridhours = new Zend_Form_Element_Select('gridhours');
     $this->_gridhours->setRegisterInArrayValidator(false);
     $this->_gridhours->addMultiOptions(array('1' => 'Sim', '2' => 'Não'));
     $this->_gridhours->setLabel("Grade de Horário");
     $this->_gridhours->setDecorators($this->_decoratorsDefault);
     $this->_gridhours->setAttrib("id", "user_gridhours");
     $this->_gridhours->setRequired(false);
 }
 public function uploadAction()
 {
     if (!$_FILES['pfile']['size']) {
         throw new Exception('上传文件为空');
     }
     $model = new CompanyModel();
     if (1 == intval($this->_request->op)) {
         $model->removeAllItems($this->token->uid);
     }
     $sql = 'INSERT INTO ' . DBTables::STOCK . ' (partno,qty,pack,dc,mfg,describe,warehouse) VALUES ';
     $fp = fopen($_FILES['pfile']['tmp_name'], 'r');
     while (!feof($fp)) {
         $line = fread($fp, 1024);
         echo $line, "\n";
     }
     fclose($fp);
 }
Example #12
0
 public function start()
 {
     if (User::company() <= 0) {
         Site::Message('Для просмотра избранного вы должны войти в систему');
         $this->route();
     } else {
         $this->company = CompanyModel::GetObj()->id(User::company());
     }
 }
Example #13
0
 public static function Get($group_id = 0, $word = '')
 {
     if ($word != '') {
         $res = SQL::Query('SELECT * FROM adw_words WHERE word Like ?', [0 => '%' . $word . '%'])->fetch(PDO::FETCH_OBJ);
     } else {
         $res = SQL::Query('SELECT * FROM adw_groups WHERE group_id = ?', [0 => $group_id])->fetch(PDO::FETCH_OBJ);
     }
     return SQL::Count() > 0 ? CompanyModel::GetObj()->id($res->company_id) : null;
 }
Example #14
0
 public function __construct()
 {
     parent::__construct();
     $physicallocationModel = new PhysicallocationModel();
     $physicallocationData = $physicallocationModel->fetchAll();
     $physicallocationArray = $physicallocationData;
     $centerModel = new CompanyModel();
     $centerDadosArray = $centerModel->fetchAll();
     $this->_cdsupplycentre = new Zend_Form_Element_Text('cdsupplycentre');
     $this->_cdsupplycentre->setLabel("Código");
     $this->_cdsupplycentre->setDecorators($this->_decoratorsDefault);
     $this->_cdsupplycentre->setAttrib("id", "center_cdsupplycentre");
     $this->_cdsupplycentre->setRequired(false);
     $this->_idsupplycentre = new Zend_Form_Element_Text('idsupplycentre');
     $this->_idsupplycentre->setLabel("Nome");
     $this->_idsupplycentre->setDecorators($this->_decoratorsDefault);
     $this->_idsupplycentre->setAttrib("id", "center_idsupplycentre");
     $this->_idsupplycentre->setRequired(false);
     $this->_fgsupplycentretype = new Zend_Form_Element_Select('fgsupplycentretype');
     $this->_fgsupplycentretype->setLabel("Tipo");
     $this->_fgsupplycentretype->addMultiOptions(array("" => "Selecione", "1" => "Consumo", "2" => "Empréstimo", "3" => "Devolução", "4" => "Estocagem", "5" => "Descarte"));
     $this->_fgsupplycentretype->setDecorators($this->_decoratorsDefault);
     $this->_fgsupplycentretype->setRequired(false);
     $this->_fgsupplycentretype->setAttrib("id", "center_fgsupplycentretype");
     $this->_cdcompany = new Zend_Form_Element_Select('cdcompany');
     $this->_cdcompany->setLabel("Unidade");
     $this->_cdcompany->addMultiOption("", "Selecione");
     foreach ($centerDadosArray as $centerDado) {
         $this->_cdcompany->addMultiOption($centerDado->cdcompany, $centerDado->nmcompany);
     }
     $this->_cdcompany->setAttrib("id", "center_cdcompany");
     $this->_cdcompany->setDecorators($this->_decoratorsDefault);
     $this->_cdcompany->setRequired(false);
     $this->_cdphysicallocation = new Zend_Form_Element_Select('cdphysicallocation');
     $this->_cdphysicallocation->setLabel("Localização Física");
     $this->_cdphysicallocation->addMultiOption("", "Selecione");
     foreach ($physicallocationArray as $arrayphysicallocation) {
         $this->_cdphysicallocation->addMultiOption($arrayphysicallocation->cdphysicallocation, $arrayphysicallocation->nmphysicallocation);
     }
     $this->_cdphysicallocation->setDecorators($this->_decoratorsRequired);
     $this->_cdphysicallocation->setAttrib("id", "center_cdphysicallocation");
     $this->_cdphysicallocation->setAttrib("class", "alpha");
     $this->_cdphysicallocation->setRequired(false);
 }
 protected function _after_select(&$result, $options)
 {
     parent::_after_select($result, $options);
     foreach ($result as $k => $v) {
         /** 工作年限 **/
         switch ($v['working_seniority']) {
             case self::WORING_SENIORITY_0_1:
                 $result[$k]['working_seniority_name'] = "一年以下";
                 break;
             case self::WORING_SENIORITY_1_3:
                 $result[$k]['working_seniority_name'] = "一到三年";
                 break;
             case self::WORING_SENIORITY_3_5:
                 $result[$k]['working_seniority_name'] = "三到五年";
                 break;
             case self::WORING_SENIORITY_5_10:
                 $result[$k]['working_seniority_name'] = "五到十年";
                 break;
             case self::WORING_SENIORITY_10_100:
                 $result[$k]['working_seniority_name'] = "十年以上";
                 break;
             default:
                 $result[$k]['working_seniority_name'] = "未知";
                 break;
         }
         /** 学历 **/
         switch ($v['education']) {
             case self::EDUCATION_JUNIOR_COLLEGE:
                 $result[$k]['education_name'] = "大专及以上";
                 break;
             case self::EDUCATION_COLLEGE:
                 $result[$k]['education_name'] = "本科及以上";
                 break;
             case self::EDUCATION_POSTGRADUATE:
                 $result[$k]['education_name'] = "研究生及以上";
                 break;
         }
         /** 关联字段 公司 **/
         if (isset($v['company'])) {
             $param = array(0 => $v['company']);
             CompanyModel::after_select_filter($param, array());
             $result[$k]['company'] = $param;
         }
         switch ($v['nature']) {
             case self::NATRUE_INTERNSHIP:
                 $result[$k]['nature_name'] = "实习";
                 break;
             case self::NATURE_FULL_TIME:
                 $result[$k]['nature_name'] = "全职";
                 break;
             case self::NATURE_PART_TIME:
                 $result[$k]['nature_name'] = "兼职";
                 break;
         }
     }
 }
Example #16
0
 public function IndexAction()
 {
     $top = CompanyModel::GetAll('id, name')->order('rate DESC', 10);
     $top_groups = GroupModel::GetAll('id, name')->order('qty DESC', 10);
     $last_company = CompanyModel::GetObj()->where('id = (select max(id) from companys)');
     $products = SQL::Query('SELECT * FROM `products` ORDER BY id DESC LIMIT 3')->fetchAll(PDO::FETCH_OBJ);
     $company_count = SQL::Query('SELECT count(*) as total FROM `companys`')->fetch(PDO::FETCH_OBJ)->total;
     $groups_count = SQL::Query('SELECT count(*) as total FROM `groups`')->fetch(PDO::FETCH_OBJ)->total;
     Site::$sub = '<div class="div30 center">' . "\n" . 'Компаний на портале <h1><a href="' . Site::Link('list') . '">' . $company_count . '</a></h1>' . "\n" . '</div>' . "\n" . '<div class="div30 center">' . "\n" . 'Сфер деятельности <h1><a href="' . Site::Link('list/setgroup') . '">' . $groups_count . '</a></h1>' . "\n" . '</div>' . "\n";
     $this->render('index', ['top_arr' => $top, 'top_groups' => $top_groups, 'last' => $last_company, 'products' => $products]);
 }
 public function dadosagendasearchAction()
 {
     $this->_helper->layout->disableLayout();
     $page = $this->_request->getParam("page", 1);
     $limit = $this->_request->getParam("rows");
     $sidx = $this->_request->getParam("sidx", 1);
     $sord = $this->_request->getParam("sord");
     $filters = $this->_request->getParam("filters");
     if ($filters != '') {
         $data = $this->buildWhereClause($filters);
     }
     $agendaModel = new AgendaModel();
     $departmentModel = new DepartmentModel();
     $companyModel = new CompanyModel();
     if (isset($data['sql']) && $data['sql'] != '') {
         $agenda = $agendaModel->fetchAll($data['sql']);
         $count = count($agenda);
         if ($count > 0) {
             $agenda = $agendaModel->fetchAll($data['sql']);
         } else {
             $total_pages = 0;
         }
         $responce = new stdClass();
         $responce->page = $page;
         $responce->records = $count;
     } else {
         $agenda = $agendaModel->fetchAll();
         $count = count($agenda);
         if ($count > 0 && $limit > 0) {
             $total_pages = ceil($count / $limit);
         } else {
             $total_pages = 0;
         }
         if ($page > $total_pages) {
             $page = $total_pages;
         }
         $agenda = $agendaModel->fetchAll();
         $responce = new stdClass();
         $responce->page = $page;
         $responce->total = $total_pages;
         $responce->records = $count;
     }
     $i = 0;
     foreach ($agenda as $row) {
         $departmento = $departmentModel->getDepartmentByAgenda($row->cdagenda);
         $company = $companyModel->getCompanyByDepartment($departmento[0]->cddepartment);
         $responce->rows[$i]['id'] = $row->cdagenda;
         $responce->rows[$i]['cddepartment'] = $departmento[0]->cddepartment;
         $responce->rows[$i]['cdcompany'] = $company[0]->cdcompany;
         $responce->rows[$i]['cell'] = array($row->cdagenda, $row->nmagenda, $company[0]->nmcompany, $departmento[0]->nmdepartment, 'Ativo', $departmento[0]->cddepartment, $company[0]->cdcompany);
         $i++;
     }
     $this->view->dadosagendasearch = $responce;
 }
Example #18
0
 public function NewrateAction()
 {
     $id = Request::GetPart(2, 0);
     $rate = intval(Request::post('rate', 0));
     if ($id > 0) {
         $company = CompanyModel::GetObj()->id($id);
         $company->rate = $rate;
         $company->save();
         Site::Message('Рейтинг компании ' . $company->name . ' успешно изменён');
         $this->route();
     }
 }
Example #19
0
 public function DeletemyaccountAction()
 {
     if (!UserModel::CheckPassword(User::GetID(), Request::post('oldpass'))) {
         Site::Message('Пароль указан не верно');
         $this->Render('index', ['company' => $this->company]);
     } else {
         GroupModel::Dec($this->company->group_id);
         CompanyModel::DeleteCompany($this->company->id);
         Site::Message('Ваш профиль был полностью удалён с сайта, мы очень сожалеем =( ');
         $this->route();
     }
 }
 public static function manage()
 {
     self::requireLogin();
     $studentId = $_SESSION['_id'];
     $applications = ApplicationStudent::getByStudent($studentId);
     $data = [];
     foreach ($applications as $application) {
         $jobId = $application->getJobId();
         $job = JobModel::getByIdMinimal($jobId);
         if (is_null($job)) {
             continue;
         }
         $companyId = $job['company'];
         $companyName = CompanyModel::getName($companyId);
         $data[] = ['title' => $job['title'], 'location' => $job['location'], 'company' => $companyName, 'jobId' => $application->getJobId(), 'submitted' => $application->isSubmitted()];
     }
     self::render('jobs/student/home', ['applications' => $data]);
 }
Example #21
0
 public function start()
 {
     $id = intval(Request::GetPart(0, User::company()));
     if ($id == 0) {
         $id = User::company();
     }
     $this->company = CompanyModel::GetObj()->id($id);
     if ($this->company->id == 0) {
         Site::Message('Профиль не найден');
         $this->Route();
     } elseif ($this->company->id != User::company() and !User::admin()) {
         Site::Message('У Вас недостаточно прав для редактирования данного профиля');
         $this->Route();
     } else {
         switch (Request::GetPart(2, '')) {
             case 'adress':
                 $this->AdressAction();
                 break;
             case 'region':
                 $this->RegionAction();
                 break;
             case 'setregion':
                 $this->SetregionAction();
                 break;
             case 'group':
                 $this->GroupAction();
                 break;
             case 'setgroup':
                 $this->SetgroupAction();
                 break;
             case 'newgroup':
                 $this->NewgroupAction();
                 break;
             case 'setlogo':
                 $this->SetLogoAction();
                 break;
             default:
                 break;
         }
     }
 }
Example #22
0
 public function start()
 {
     $id = intval(Request::GetPart(0, User::company()));
     if ($id == 0) {
         $id = User::company();
     }
     $this->company = CompanyModel::GetObj()->id($id);
     if (User::admin() and $this->company->id == 0) {
         $this->Route();
     } elseif ($id == 0 and User::isLogged()) {
         Site::Message('Похоже Вы не завершили регистрацию своего профиля, вы можете продолжить её тут:');
         $this->route('newcompany');
     } elseif ($this->company->id == 0) {
         Site::Message('Профиль не найден');
         $this->Route();
     } else {
         $this->company->about = nl2br($this->company->about);
         if (Request::GetPart(2, '') == 'favorite') {
             $this->FavoriteSet($id);
         }
     }
 }
 public function __construct()
 {
     parent::__construct();
     $covenantModel = new CovenantModel();
     $selectCovenant = $covenantModel->fetchAll();
     $company = new CompanyModel();
     $selectCompany = $company->fetchAll('cdcompanyparent IS NULL');
     $departmentModel = new DepartmentModel();
     $selectDepartment = $departmentModel->fetchAll();
     $nmcollectionplaceModel = new CompanyModel();
     $selectCompany = $nmcollectionplaceModel->fetchAll();
     $clientModel = new ClientModel();
     $clientData = $clientModel->fetchAll();
     $this->_cdcovenant = new Zend_Form_Element_Select('cdcovenant');
     $this->_cdcovenant->setAttrib("id", "covenantbilling_cdcovenant");
     $this->_cdcovenant->setAttrib("class", "check_multiple_select");
     foreach ($selectCovenant as $value) {
         //$this->_cdcovenant->addMultiOption($value->cdcovenant, $value->nmcovenant);
     }
     $this->_cdcovenant->setLabel("Convênio");
     $this->_cdcovenant->setDecorators($this->_decoratorsDefault);
     $this->_cdcovenant->setRegisterInArrayValidator(false);
     $this->_cdcovenant->setRequired(false);
     $this->_cdcompanyparent = new Zend_Form_Element_Select('cdcompanyparent');
     $this->_cdcompanyparent->setAttrib("id", "controltbilling_cdcompanyparent");
     foreach ($selectCompany as $value) {
         $this->_cdcompanyparent->addMultiOption($value->cdcompany, $value->nmcompany);
     }
     $this->_cdcompanyparent->setLabel("Posto de Coleta");
     $this->_cdcompanyparent->setDecorators($this->_decoratorsDefault);
     $this->_cdcompanyparent->setRegisterInArrayValidator(false);
     $this->_cdcompanyparent->setRequired(false);
     $this->_cddepartment = new Zend_Form_Element_Select('cddepartment');
     $this->_cddepartment->setAttrib("id", "covenantbilling_ceddepartment");
     $this->_cddepartment->setAttrib("class", "check_multiple_select");
     foreach ($selectDepartment as $value) {
         $this->_cddepartment->addMultiOption($value->cddepartment, $value->nmdepartment);
     }
     $this->_cddepartment->setLabel("Setor");
     $this->_cddepartment->setDecorators($this->_decoratorsDefault);
     $this->_cddepartment->setRegisterInArrayValidator(false);
     $this->_cddepartment->setRequired(false);
     $this->_fgstatus = new Zend_Form_Element_Select('fgstatus');
     $this->_fgstatus->setAttrib("id", "covenantbilling_fgstatus");
     $this->_fgstatus->setMultiOptions(array("0" => "Selecione", "1" => "Ativo", "2" => "Inativo"));
     $this->_fgstatus->setLabel("Status");
     $this->_fgstatus->setDecorators($this->_decoratorsDefault);
     $this->_fgstatus->setRegisterInArrayValidator(false);
     $this->_fgstatus->setRequired(false);
     //$clientData
     $this->_cdclient = new Zend_Form_Element_Text('cdclient');
     $this->_cdclient->setAttrib("id", "covenantbilling_cdclient");
     $this->_cdclient->setAttrib("onkeyup", "lookup(this.value);");
     $this->_cdclient->setAttrib("onblur", "fill();");
     $this->_cdclient->setAttrib("autocomplete", "off");
     $this->_cdclient->setAttrib("size", "50");
     //         foreach ($clientData as $value) {
     //            $this->_cdclient->addMultiOption($value->cdclient, $value->nmclient);
     //        }
     $this->_cdclient->setLabel("Paciente");
     $this->_cdclient->setDecorators($this->_decoratorsDefault);
     $this->_cdclient->setRequired(false);
     $this->_dtstart = new Zend_Form_Element_Text('dtstart');
     $this->_dtstart->setAttrib("id", "covenantbilling_dtstart");
     $this->_dtstart->setAttrib("class", "datepicker");
     $this->_dtstart->setLabel("Data Inicio");
     $this->_dtstart->setDecorators($this->_decoratorsDefault);
     $this->_dtstart->setRequired(false);
     $this->_hrend = new Zend_Form_Element_Text('dtenddate');
     $this->_hrend->setLabel("Hora Início");
     $this->_hrend->setDecorators($this->_decoratorsDefault);
     $this->_hrend->setAttrib("id", "covenantbilling_hrend");
     $this->_hrend->setAttrib("class", "mask_time");
     $this->_dtend = new Zend_Form_Element_Text('dtend');
     $this->_dtend->setAttrib("id", "covenantbilling_dtenddate");
     $this->_dtend->setAttrib("class", "datepicker");
     $this->_dtend->setLabel("Data Fim");
     $this->_dtend->setDecorators($this->_decoratorsDefault);
     $this->_dtend->setRequired(false);
     $this->_hrstart = new Zend_Form_Element_Text('hrstart');
     $this->_hrstart->setLabel("Hora Fim");
     $this->_hrstart->setDecorators($this->_decoratorsDefault);
     $this->_hrstart->setAttrib("id", "covenantbilling_hrstart");
     $this->_hrstart->setAttrib("class", "mask_time");
     $this->_nrbatch = new Zend_Form_Element_Text('nrlot');
     $this->_nrbatch->setAttrib("id", "covenantbilling_nrbatch");
     $this->_nrbatch->setLabel("Número do Lote");
     $this->_nrbatch->setDecorators($this->_decoratorsDefault);
     $this->_nrbatch->setRequired(false);
     $this->_dtduedate = new Zend_Form_Element_Text('dtduedate');
     $this->_dtduedate->setAttrib("id", "covenantbilling_dtduedate");
     $this->_dtduedate->setAttrib("class", "datepicker");
     $this->_dtduedate->setLabel("Vencimento");
     $this->_dtduedate->setDecorators($this->_decoratorsDefault);
     $this->_dtduedate->setRequired(false);
 }
Example #24
0
$result = 'OK';
$companyId = '';
$agencyCompanyId = Tools::param('agencyCompanyId');
$companyName = Tools::param('companyName');
$companyAddress1 = Tools::param('companyAddress1');
$companyAddress2 = Tools::param('companyAddress2');
$companyCity = Tools::param('companyCity');
$companyState = Tools::param('companyState');
$companyZip = Tools::param('companyZip');
$companyPhone = Tools::param('companyPhone');
$companyUrl = Tools::param('companyUrl');
$rowStyle = Tools::param('rowStyle');
$rowId = Tools::param('rowId');
$newCompanyModel = null;
try {
    $companyModel = new CompanyModel();
    $companyModel->setAgencyCompanyId($agencyCompanyId);
    $companyModel->setCompanyName($companyName);
    $companyModel->setCompanyAddress1($companyAddress1);
    $companyModel->setCompanyAddress2($companyAddress2);
    $companyModel->setCompanyCity($companyCity);
    $companyModel->setCompanyState($companyState);
    $companyModel->setCompanyZip($companyZip);
    $companyModel->setCompanyPhone($companyPhone);
    $companyModel->setCompanyUrl($companyUrl);
    $companyController = new CompanyController();
    $companyId = $companyController->add($companyModel);
    if (!($companyId > 0)) {
        throw new ControllerException("Add failed.");
    }
    $newCompanyModel = $companyController->get($companyId);
Example #25
0
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License along
 * with this program; if not, write to the Free Software Foundation, Inc.,
 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
 *
 */
require_once "Libs/autoload.php";
$auth = new Auth();
if (!$auth->isAuthorized()) {
    $auth->forbidden();
    exit(0);
    // Should never get here but just in case...
}
$result = "OK";
$id = Tools::param('id');
$mode = Tools::param('mode');
$rowStyle = Tools::param('rowStyle');
$html = '';
$companyListView = new CompanyListView('html', null);
if ('add' == $mode) {
    $companyModel = new CompanyModel();
    $companyModel->setId($id);
    $htmlRows = $companyListView->displayCompanyRow($companyModel, $mode, $rowStyle);
} else {
    $companyController = new CompanyController();
    $companyModel = $companyController->get($id);
    $htmlRows = $companyListView->displayCompanyRow($companyModel, $mode, $rowStyle);
}
$result = array('result' => $result, 'rows' => $htmlRows);
echo json_encode($result) . PHP_EOL;
 private static function submit(MongoId $jobId, MongoId $studentId, array $questions)
 {
     $answers = array();
     foreach ($questions as $_id => $answer) {
         $answers[] = ['_id' => $_id, 'answer' => $answer];
     }
     $application = ApplicationStudent::save($jobId, $studentId, $answers);
     $applicationId = $application->getId();
     $submitted = ApplicationStudent::submit($applicationId);
     if ($submitted) {
         $job = JobModel::getByIdMinimal($jobId);
         $jobTitle = $job['title'];
         $linkApplicants = "http://sublite.net/employers/viewapplicants/{$jobId}";
         $linkManage = "http://sublite.net/employers/home";
         $recruiterId = $job['recruiter'];
         $recruiter = RecruiterModel::getByIdMinimal($recruiterId);
         $recruiterFirstname = $recruiter['firstname'];
         $recruiterEmail = $recruiter['email'];
         $message = "\n          Hi {$recruiterFirstname},\n          <br /><br />\n          You have received a new applicant for your job: <b>{$jobTitle}</b>!\n          <br /><br />\n          To unlock and view this application, go to\n          <a href='{$linkApplicants}'>View Applicants</a>.\n          <br />\n          To manage your jobs, go to <a href='{$linkManage}'>Manage</a>.\n          <br /><br />\n          View Applicants: <a href='{$linkApplicants}'>{$linkApplicants}</a><br />\n          Manage Jobs: <a href='{$linkManage}'>{$linkManage}</a><br />\n          <br /><br />\n          -------------------<br />\n          Team SubLite\n          <br /><br />\n          Please let us know if you have any questions. We hope you find the\n          right candidate for your job.\n        ";
         sendgmail([$recruiterEmail], "*****@*****.**", "New Applicant for '{$jobTitle}' | SubLite", $message);
         //send an email to the student
         $companyId = $job['company'];
         $company = CompanyModel::getById($companyId);
         $companyName = $company['name'];
         $student = StudentModel::getByIdMinimal($studentId);
         $studentFirstName = $student['name'];
         $studentEmail = $student['email'];
         $linkApplication = "http://sublite.net/jobs/application/{$applicationId}";
         $linkJob = "http://sublite.net/job?id={$jobId}";
         $linkJobSearch = "http://sublite.net/jobs/search";
         $linkJobsByCompany = "http://sublite.net/jobs/search?byrecruiter={$recruiterId}";
         $message = "\n          Hi {$studentFirstName},\n          <br />\n          <br />{$companyName} has successfully received your <a href='{$linkApplication}'>application</a> for <b>{$jobTitle}</b>!<br />\n          <br />View your application: {$linkApplication}\n          <br />View the job you applied to {$linkJob}\n          <br />View more jobs by {$linkJobsByCompany}<br />\n          <br />You are now one step closer to finding your perfect summer experience! Take more steps by applying to more jobs: {$linkJobSearch}<br />\n          -------------------<br />\n          Good luck!\n          <br />\n          Team SubLite\n        ";
         sendgmail([$studentEmail], "*****@*****.**", "Confirmation for Job Application", $message);
         self::redirect("../application/{$applicationId}");
     }
     self::error("You must attach a resume to your profile in order to submit " . "an application.");
 }
 public function ConfirmlogoAction()
 {
     $company = CompanyModel::GetObj()->id(User::company());
     if ($company->id > 0) {
         $this->render('confirmlogo', ['logo' => $company->logo]);
     } else {
         Site::Error('Непредвиденная ошибка');
         $this->route();
     }
 }
Example #28
0
 public function company()
 {
     return $this->cid ? CompanyModel::find($this->id) : '本网站';
 }
 public function job_detail_new()
 {
     $id = $_GET['jobid'];
     if (empty($id)) {
         header("location:/index.php?s=/Job/job_list");
         exit;
     }
     if (!is_numeric($id)) {
         $jobTmpInfo = M("job")->where("guid='{$id}'")->find();
         header("location:/index.php?s=/Job/job_detail_new/jobid/" . $jobTmpInfo['id']);
         exit;
     }
     $jobOb = new JobModel();
     $result = $jobOb->get_detail($id);
     //var_dump($result);
     $tag = 0;
     //默认是未收藏状态
     //判断当前用户是否登陆,如果登陆判断当前页面当前用户是否已藏
     $userinfo = $_SESSION['userinfo'];
     if (!empty($userinfo)) {
         $username = $userinfo['username'];
         //判断当前页面当前用户是否已藏
         $jcOb = M("job_collection");
         $jcArr = $jcOb->where("username='******' and status=1 and j_id=" . $id)->find();
         //echo $jcOb ->getLastSql();
         //var_dump($jcArr);
         if (!empty($jcArr)) {
             $tag = 1;
             //收藏表里有相关数据,改为已收藏状态
         }
     }
     ///////////////////////////////////////处理分享//////////////////////////////////////////////////////
     $shareUrl2 = rtrim($_GET['share'], ".html");
     $url = decrypt($shareUrl2, "share");
     if ($url == false) {
         $shareUrl2 = str_replace(" ", "+", $shareUrl2);
         $url = decrypt($shareUrl2, "share");
     }
     //如果是分享连接
     if (strpos($url, "tag") !== false && strpos($url, "channel") !== false) {
         $arUrl = explode("&", $url);
         $shareUrl2 = array();
         foreach ($arUrl as $u) {
             $au = explode("=", $u);
             $shareUrl2[$au[0]] = $au[1];
         }
         $_SESSION['shareurl'] = "http://" . $_SERVER['SERVER_NAME'] . $_SERVER['REQUEST_URI'];
         $_SESSION['backurl'] = $_SERVER['HTTP_REFERER'];
         $_SESSION['sharetag'] = $shareUrl2['tag'];
         $_SESSION['sharechannel'] = $shareUrl2['channel'];
         $_SESSION['shareaid'] = $shareUrl2['aid'];
         $_SESSION['shareuname'] = $shareUrl2['uname'];
         //echo "<pre>";var_dump($_SESSION);echo "</pre>";
     }
     ///////////////////////////////////////处理分享//////////////////////////////////////////////////////
     //如果不是分享过来的,则判断登陆没有,如果没有登陆则不允许浏览
     if ($this->isLogin == true) {
         setcookie("gourl", "/index.php?s=/Job/job_detail/id/" . $id, time() + 3600, "/");
         header("location:/index.php?s=/Login/login");
         die;
     } else {
         setcookie("gourl", "", time() - 1, "/");
     }
     //分享相关
     $requestUrl = $_SERVER['QUERY_STRING'];
     $shareUrl = "http://m.renrenlie.com/index.php";
     if ($_SESSION['userinfo']['username']) {
         $username = $_SESSION['userinfo']['username'];
         $shareUrlTmp = "tag=ShareJob&channel=WapShare&aid=" . C('SHARE_JOB_ID') . "&uname=" . $username;
         $shareUrl = $shareUrl . "?" . $requestUrl . "&share=" . encrypt($shareUrlTmp, "share");
     } else {
         $username = "";
         $shareUrl = $shareUrl . "?" . $requestUrl;
     }
     //得到热招职位
     $WxComModel = new CompanyModel();
     $result_job = $WxComModel->get_hot_job($result['cpid']);
     //得到评论列表
     $arComment = M("evaluate")->where("tag='record' and j_id={$result['id']} and status=0")->select();
     if (empty($arComment)) {
         $arComment = array();
     }
     foreach ($arComment as $k => $v) {
         $arComment[$k]['time'] = date("Y-m-d", $v['created_at']);
     }
     $share['url'] = $shareUrl;
     $share['title'] = "即刻分享" . $result['title'] . "职位,立得N个“百元”现金。";
     $share['description'] = "【人人猎】" . $result['cpname'] . "直招" . $result['title'] . "职位" . $result['employ'] . "人,月薪:" . $result['treatmentdata'] . " ,推荐或自荐成功入职即得推荐奖金" . $result['Tariff'] . "元。";
     $this->assign("shareurl", $shareUrl);
     $this->assign("share", $share);
     //echo "<pre>";var_dump($result);echo "</pre>";
     $this->assign("tag", $tag);
     $this->assign("result", $result);
     $this->assign("result_job", $result_job);
     $this->assign("arComment", $arComment);
     $this->assign("jobname", $result['title']);
     $this->assign("empty", "<div style='font-size: 14px;color: #b4b4b4;text-align:center;margin-top:10px;'>暂无评论!</div>");
     if (!empty($_SESSION['cuserinfo'])) {
         //为引入的头部传入标题
         $lArr = array(array("name" => "回到首页", "url" => "/", "img" => "/Public/new-images/head-icon/m-icon1.png"));
     } else {
         //为引入的头部传入标题
         $lArr = array(array("name" => "回到首页", "url" => "/", "img" => "/Public/new-images/head-icon/m-icon1.png"), array("name" => "推荐职位", "url" => "/index.php?s=/Job/job_list", "img" => "/Public/new-images/head-icon/m-icon7.png"), array("name" => "职位收藏", "url" => "/index.php?s=/Job/fav_job", "img" => "/Public/new-images/head-icon/m-icon8.png"));
     }
     $this->assign("lArr", $lArr);
     $this->assign("header_title", "推荐职位");
     $this->assign("select", "collect");
     $this->display("./Job/job_detail_new");
 }
 public function listAction()
 {
     $companyModel = new CompanyModel();
     $departmentModel = new DepartmentModel();
     $companyAffiliatesData = $companyModel->getAfilliatesByCompany();
     $companyParentData = $companyModel->getCompanyMatriz();
     $this->view->companyParentData = $companyParentData;
     $this->view->companyAffiliatesData = $companyAffiliatesData;
     $departmentparentData = $departmentModel->getAllParent();
     $this->view->departmentparentData = $departmentparentData;
     $departmentfilliatestData = $departmentModel->getDepartmentAfilliates();
     $this->view->departmentfilliatestData = $departmentfilliatestData;
     $controllerName = $this->getRequest()->getControllerName();
     $actionName = $this->getRequest()->getActionName();
     $cdwindow = $this->getCdWindow($controllerName, $actionName);
     $_SESSION['cdwindow'] = $cdwindow;
     $company = $this->_request->getParam("company");
     $department = $this->_request->getParam("department");
     $nmdepartment = $this->_request->getParam("nmdepartament");
     $this->view->company = $company;
     $this->view->department = $department;
     $this->view->nmdepartment = $nmdepartment;
     $userDataDepartamenData = new CompanyModel();
     $userDataCompanyDepartment = $userDataDepartamenData->fetchAll();
     $this->view->userDataCompanyDepartment = $userDataCompanyDepartment;
     $userDataDepartamentByCompany = $this->_model->fetchAll($this->_model->getAllDepartmentCompany());
     $this->view->userDataDepartamentByCompany = $userDataDepartamentByCompany;
 }