public function departmentAction()
 {
     $id = $this->_getParam('id');
     $departments = Application_Model_M_ConsultationDepartments::fetchByCID($id);
     if (count($departments) > 0) {
         $out['errno'] = '0';
         $results = array();
         foreach ($departments as $department) {
             $result = array('id' => $department->getId(), 'name' => $department->getName());
             array_push($results, $result);
         }
         $out['departments'] = $results;
     } else {
         $out['errno'] = '1';
     }
     $out['msg'] = Yy_ErrMsg_Department::getMsg('department', $out['errno']);
     Yy_Utils::jsonOut($out);
 }
 public function delete()
 {
     $where = 'id=' . $this->getId();
     return Application_Model_M_ConsultationDepartments::delete($where);
 }
Beispiel #3
0
 public static function getConsultationDepartmentNameByDID($did)
 {
     $str = "";
     $depart = Application_Model_M_ConsultationDepartments::find($did);
     if ($depart) {
         $str = $depart->getName();
     }
     return $str;
 }
 public function departdelAction()
 {
     $this->getResponse()->setHeader('Content-Type', 'application/json');
     $this->_helper->viewRenderer->setNoRender(true);
     $this->_helper->layout()->disableLayout();
     $id = $this->_getParam('id');
     try {
         Application_Model_M_ConsultationDepartments::delById($id);
         $out['errno'] = "0";
     } catch (Zend_Db_Exception $e) {
         $out['errno'] = "1";
     }
     Yy_Utils::jsonOut($out);
 }