/** * */ public function certificateAction() { $id = $this->_getParam('id'); $case = $this->_mapper->detailCase($id); $data = array('beneficiary' => Client_Model_Mapper_Client::buildNameById($case->fk_id_perdata), 'evidence' => Client_Model_Mapper_Client::buildNumById($case->fk_id_perdata)); $file = APPLICATION_PATH . '/../public/forms/Kazu/Sertifikadu_Atendimentu.rtf'; App_Util_Export::toRtf($file, $data); }
/** * * @return int|bool */ public function save() { $dbAdapter = Zend_Db_Table_Abstract::getDefaultAdapter(); $dbAdapter->beginTransaction(); try { $date = new Zend_Date($this->_data['date_appointment']); $date->set($this->_data['time_appointment'], Zend_Date::TIME_SHORT); $dataForm = $this->_data; $today = new Zend_Date(); $this->_data['date_appointment'] = $date->toString('yyyy-MM-dd HH:mm'); if (empty($this->_data['id_appointment'])) { if ($date->isEarlier($today)) { $this->_message->addMessage('Erro: Data no Oras ba audiensia uluk data ohin.', App_Message::ERROR); $this->addFieldError('date_appointment')->addFieldError('time_appointment'); return false; } $mapperCase = new Client_Model_Mapper_Case(); $case = $mapperCase->detailCase($this->_data['fk_id_action_plan']); $this->_data['fk_id_perdata'] = $case->fk_id_perdata; $this->_data['appointment_active'] = 1; $this->_data['appointment_filled'] = 0; } // Save the Note $id = parent::_simpleSave(); // Delete and insert all objetives $dbAppointmentObjective = App_Model_DbTable_Factory::get('Appointment_has_Objective'); $where = array($dbAdapter->quoteInto('fk_id_appointment = ?', $id)); $dbAppointmentObjective->delete($where); // Insert the news objectives foreach ($dataForm['objective'] as $objective) { $row = $dbAppointmentObjective->createRow(); $row->fk_id_appointment = $id; $row->fk_id_appointment_objective = $objective; $row->save(); } $dbAdapter->commit(); return $id; } catch (Exception $e) { $dbAdapter->rollBack(); $this->_message->addMessage($this->_config->messages->error, App_Message::ERROR); return false; } }
/** * * @return int|bool */ public function save() { $dbAdapter = Zend_Db_Table_Abstract::getDefaultAdapter(); $dbAdapter->beginTransaction(); try { if (empty($this->_data['id_case_note'])) { $mapperCase = new Client_Model_Mapper_Case(); $case = $mapperCase->detailCase($this->_data['fk_id_action_plan']); $this->_data['fk_id_perdata'] = $case->fk_id_perdata; $this->_data['fk_id_sysuser'] = Zend_Auth::getInstance()->getIdentity()->id_sysuser; } // Save the Note $id = parent::_simpleSave(); $dbAdapter->commit(); return $id; } catch (Exception $e) { $dbAdapter->rollBack(); $this->_message->addMessage($this->_config->messages->error, App_Message::ERROR); return false; } }
/** * * @param array $data * @return string */ public function geClassShortlist($data) { $mapperStudentClass = new StudentClass_Model_Mapper_StudentClass(); $mapperClient = new Client_Model_Mapper_Client(); $mapperCase = new Client_Model_Mapper_Case(); $class = $mapperStudentClass->detailStudentClass($data['class']); $client = $mapperClient->detailClient($data['client']); $case = $mapperCase->detailCase($data['case']); $view = Zend_Layout::getMvcInstance()->getView(); $link = '<a href="%s" target="_blank">%s</a>'; $className = str_pad($class->id_fefpstudentclass, 5, '0', STR_PAD_LEFT) . ' - ' . $class->class_name; $clientName = Client_Model_Mapper_Client::buildNumRow($client) . ' - ' . Client_Model_Mapper_Client::buildName($client); $aClass = sprintf($link, $view->baseUrl('/student-class/register/edit/id/' . $class->id_fefpstudentclass), $class->name_dec . ' - ' . $className); $aClient = sprintf($link, $view->baseUrl('/client/client/print/id/' . $client->id_perdata), $clientName); $idCase = str_pad($case->id_action_plan, 5, '0', STR_PAD_LEFT); return sprintf(self::JOB_SHORTLIST, $aClient, $idCase, $case->name_dec, $case->name, $aClass, $class->name_dec); }