public function init() { $this->setName('f2')->setAttrib('enctype', 'multipart/form-data')->setMethod('post'); $this->addElement('Hidden', 'search', array('value' => 1)); $tieu_de = new Zend_Form_Element_Text('tieu_de'); $tieu_de->setLabel('Tiêu đề (*)')->setRequired(true)->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty')->setDecorators(array('ViewHelper', 'Errors', array(array('data' => 'HtmlTag'), array('tag' => 'td', 'style' => 'width: 90%')), array('Label', array('tag' => 'td')), array(array('row' => 'HtmlTag'), array('tag' => 'tr'))))->setAttrib('class', 'text-input large-input'); $cateOptions = Khcn_Api::_()->getDbTable('loai_thong_tin', 'default')->getListAssoc(); $loai_thong_tin_id = new Zend_Form_Element_Select('loai_thong_tin_id'); $loai_thong_tin_id->setLabel('Loại (*)')->addMultiOptions($cateOptions)->setDecorators(array('ViewHelper', 'Errors', array(array('data' => 'HtmlTag'), array('tag' => 'td')), array('Label', array('tag' => 'td')), array(array('row' => 'HtmlTag'), array('tag' => 'tr'))))->setAttrib('class', 'text-input'); $statusOptions = array("multiOptions" => Default_Model_Constraints::trang_thai()); $trang_thai = new Zend_Form_Element_Radio('trang_thai', $statusOptions); $trang_thai->setRequired(true)->setLabel('Trạng thái')->setValue('1')->setSeparator('')->setDecorators(array('ViewHelper', 'Errors', array(array('data' => 'HtmlTag'), array('tag' => 'td')), array('Label', array('tag' => 'td')), array(array('row' => 'HtmlTag'), array('tag' => 'tr')))); $noi_dung = new Zend_Form_Element_Textarea('noi_dung'); $noi_dung->setLabel('Nội dung (*)')->setRequired(true)->addValidator('NotEmpty')->setDecorators(array('ViewHelper', 'Errors', array(array('data' => 'HtmlTag'), array('tag' => 'td')), array('Label', array('tag' => 'td')), array(array('row' => 'HtmlTag'), array('tag' => 'tr'))))->setAttribs(array('id' => 'noi_dung', 'class' => 'text-input textarea')); $noi_bat = new Zend_Form_Element_Select('noi_bat'); $noi_bat->setLabel('Nổi Bật')->setRequired(true)->setValue(0)->addMultiOptions(array(0 => 'Không', 1 => 'Có'))->setDecorators(array('ViewHelper', 'Errors', array(array('data' => 'HtmlTag'), array('tag' => 'td')), array('Label', array('tag' => 'td')), array(array('row' => 'HtmlTag'), array('tag' => 'tr')))); $photo = new Zend_Form_Element_File('photo'); $photo->setLabel('Upload hình')->setDescription('(*.jgp, *.gif, *.png , < 10MB )')->setDestination(BASE_PATH . '/upload/files/thong_tin')->addValidator(new Zend_Validate_File_Extension(array('jpg,gif,png')))->addValidator(new Zend_Validate_File_FilesSize(array('min' => 1, 'max' => 10485760, 'bytestring' => true)))->setDecorators(array('File', 'Errors', array('Description', array('escape' => false, 'tag' => 'div', 'placement' => 'append')), array('HtmlTag', array('tag' => 'td')), array('Label', array('tag' => 'td')), array(array('row' => 'HtmlTag'), array('tag' => 'tr')))); $submitCon = new Zend_Form_Element_Submit('submitCon'); $submitCon->setDecorators(array('ViewHelper', array(array('data' => 'HtmlTag'), array('tag' => 'span')), array(array('row' => 'HtmlTag'), array('tag' => 'span'))))->setAttribs(array('class' => 'button')); $submitExit = new Zend_Form_Element_Submit('submitExit'); $submitExit->setDecorators(array('ViewHelper', array(array('data' => 'HtmlTag'), array('tag' => 'span')), array(array('row' => 'HtmlTag'), array('tag' => 'span'))))->setAttribs(array('class' => 'button')); $cancel = new Zend_Form_Element_Button('cancel'); $cancel->setDecorators(array('ViewHelper', array(array('data' => 'HtmlTag'), array('tag' => 'span')), array(array('row' => 'HtmlTag'), array('tag' => 'span'))))->setAttribs(array('class' => 'button', 'onclick' => 'window.location.href="' . $_SERVER['HTTP_REFERER'] . '"')); $this->addElements(array($loai_thong_tin_id, $tieu_de, $noi_dung, $trang_thai, $noi_bat, $photo, $submitCon, $submitExit, $cancel)); $this->addDisplayGroup(array('submitCon', 'submitExit', 'cancel'), 'submit', array('decorators' => array('FormElements', array(array('data' => 'HtmlTag'), array('tag' => 'td', 'colspan' => 2)), array(array('row' => 'HtmlTag'), array('tag' => 'td'))))); $this->setDecorators(array('FormElements', array('HtmlTag', array('tag' => 'table')), 'Form')); }
public function init() { $this->setName('f2')->setAttrib('enctype', 'multipart/form-data')->setMethod('post'); $this->addElement('Hidden', 'search', array('value' => 1)); $tieu_de = new Zend_Form_Element_Text('tieu_de'); $tieu_de->setLabel('Tiêu đề (*)')->setRequired(true)->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty')->setDecorators(array('ViewHelper', 'Errors', array(array('data' => 'HtmlTag'), array('tag' => 'td', 'style' => 'width: 90%')), array('Label', array('tag' => 'td')), array(array('row' => 'HtmlTag'), array('tag' => 'tr'))))->setAttrib('class', 'text-input large-input'); $cateOptions = Khcn_Api::_()->getDbTable('loai_su_diep', 'default')->getListAssoc(); $loai_su_diep_id = new Zend_Form_Element_Select('loai_su_diep_id'); $loai_su_diep_id->setLabel('Loại (*)')->addMultiOptions($cateOptions)->setDecorators(array('ViewHelper', 'Errors', array(array('data' => 'HtmlTag'), array('tag' => 'td')), array('Label', array('tag' => 'td')), array(array('row' => 'HtmlTag'), array('tag' => 'tr'))))->setAttrib('class', 'text-input'); $statusOptions = array("multiOptions" => Default_Model_Constraints::trang_thai()); $trang_thai = new Zend_Form_Element_Radio('trang_thai', $statusOptions); $trang_thai->setRequired(true)->setLabel('Trạng thái')->setValue('1')->setSeparator('')->setDecorators(array('ViewHelper', 'Errors', array(array('data' => 'HtmlTag'), array('tag' => 'td')), array('Label', array('tag' => 'td')), array(array('row' => 'HtmlTag'), array('tag' => 'tr')))); $noi_dung = new Zend_Form_Element_Textarea('noi_dung'); $noi_dung->setLabel('Nội dung (*)')->setRequired(true)->addValidator('NotEmpty')->setDecorators(array('ViewHelper', 'Errors', array(array('data' => 'HtmlTag'), array('tag' => 'td')), array('Label', array('tag' => 'td')), array(array('row' => 'HtmlTag'), array('tag' => 'tr'))))->setAttribs(array('id' => 'noi_dung', 'class' => 'text-input textarea')); $soundcloud_embed = new Zend_Form_Element_Text('soundcloud_embed'); $soundcloud_embed->setLabel('SoundCloud')->setDescription('How to get SoundCloud embed code? <a href="http://help.soundcloud.com/customer/portal/articles/243751-how-can-i-put-my-track-or-playlist-on-my-site-or-blog-" target="_blank">Click here</a>')->setDecorators(array('ViewHelper', 'Errors', array('Description', array('tag' => 'div', 'escape' => false, 'placement' => 'append')), array(array('data' => 'HtmlTag'), array('tag' => 'td', 'style' => 'width: 90%')), array('Label', array('tag' => 'td')), array(array('row' => 'HtmlTag'), array('tag' => 'tr'))))->setAttrib('class', 'text-input large-input'); $youtube_embed = new Zend_Form_Element_Text('youtube_embed'); $youtube_embed->setLabel('Youtube')->setDescription('How to get Youtube embed code? <a href="https://support.google.com/youtube/answer/171780?hl=en" target="_blank">Click here</a>')->setDecorators(array('ViewHelper', 'Errors', array('Description', array('tag' => 'div', 'escape' => false, 'placement' => 'append')), array(array('data' => 'HtmlTag'), array('tag' => 'td', 'style' => 'width: 90%')), array('Label', array('tag' => 'td')), array(array('row' => 'HtmlTag'), array('tag' => 'tr'))))->setAttrib('class', 'text-input large-input'); $noi_bat = new Zend_Form_Element_Select('noi_bat'); $noi_bat->setLabel('Nổi Bật')->setRequired(true)->setValue(0)->addMultiOptions(array(0 => 'Không', 1 => 'Có'))->setDecorators(array('ViewHelper', 'Errors', array(array('data' => 'HtmlTag'), array('tag' => 'td')), array('Label', array('tag' => 'td')), array(array('row' => 'HtmlTag'), array('tag' => 'tr')))); $photo = new Zend_Form_Element_File('photo'); $photo->setLabel('Upload hình')->setDescription('(*.jgp, *.gif, *.png , < 10MB )')->setDestination(BASE_PATH . '/upload/files/su_diep')->addValidator(new Zend_Validate_File_Extension(array('jpg,gif,png')))->addValidator(new Zend_Validate_File_FilesSize(array('min' => 1, 'max' => 10485760, 'bytestring' => true)))->setDecorators(array('File', 'Errors', array('Description', array('escape' => false, 'tag' => 'div', 'placement' => 'append')), array('HtmlTag', array('tag' => 'td')), array('Label', array('tag' => 'td')), array(array('row' => 'HtmlTag'), array('tag' => 'tr')))); $submitCon = new Zend_Form_Element_Submit('submitCon'); $submitCon->setDecorators(array('ViewHelper', array(array('data' => 'HtmlTag'), array('tag' => 'span')), array(array('row' => 'HtmlTag'), array('tag' => 'span'))))->setAttribs(array('class' => 'button')); $submitExit = new Zend_Form_Element_Submit('submitExit'); $submitExit->setDecorators(array('ViewHelper', array(array('data' => 'HtmlTag'), array('tag' => 'span')), array(array('row' => 'HtmlTag'), array('tag' => 'span'))))->setAttribs(array('class' => 'button')); $cancel = new Zend_Form_Element_Button('cancel'); $cancel->setDecorators(array('ViewHelper', array(array('data' => 'HtmlTag'), array('tag' => 'span')), array(array('row' => 'HtmlTag'), array('tag' => 'span'))))->setAttribs(array('class' => 'button', 'onclick' => 'window.location.href="' . $_SERVER['HTTP_REFERER'] . '"')); $this->addElements(array($loai_su_diep_id, $tieu_de, $noi_dung, $soundcloud_embed, $youtube_embed, $noi_bat, $photo, $trang_thai, $submitCon, $submitExit, $cancel)); $this->addDisplayGroup(array('submitCon', 'submitExit', 'cancel'), 'submit', array('decorators' => array('FormElements', array(array('data' => 'HtmlTag'), array('tag' => 'td', 'colspan' => 2)), array(array('row' => 'HtmlTag'), array('tag' => 'td'))))); $this->setDecorators(array('FormElements', array('HtmlTag', array('tag' => 'table')), 'Form')); }
public function changePassAction() { // Set up require's $this->_helper->requireUser(); $viewer = Khcn_Api::_()->getViewer(); // Can specifiy custom id $id = $this->_getParam('id', null); if (null === $id) { $user = $viewer; } else { $user = Khcn_Api::_()->getItem('default_nguoi_dung', $id); } $form = new Default_Form_ChangePass(); $form->submit->setLabel('Lưu'); $form->cancel->setLabel('Không lưu'); $this->view->form = $form; if (!$this->getRequest()->isPost()) { return; } if (!$form->checkIsValid($this->getRequest()->getPost(), $user)) { return; } $values = $form->getValues(); $mat_khau = $values['mat_khau1']; $user->mat_khau = md5($mat_khau); $user->save(); return $this->_forward('thong-bao', 'index', 'default', array('messages' => array(Zend_Registry::get('Zend_Translate')->_('Thành công. Dữ liệu đã được cập nhật.')))); }
public function init() { $this->setName('f2')->setAttrib('enctype', 'multipart/form-data')->setMethod('post'); $this->addElement('Hidden', 'search', array('value' => 1)); $tieu_de = new Zend_Form_Element_Text('tieu_de'); $tieu_de->setLabel('Tiêu đề (*)')->setRequired(true)->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty')->setDecorators(array('ViewHelper', 'Errors', array(array('data' => 'HtmlTag'), array('tag' => 'td', 'style' => 'width: 90%')), array('Label', array('tag' => 'td')), array(array('row' => 'HtmlTag'), array('tag' => 'tr'))))->setAttrib('class', 'text-input large-input'); $cateOptions = Khcn_Api::_()->getDbTable('loai_audio', 'default')->getListAssoc(); $loai_audio_id = new Zend_Form_Element_Select('loai_audio_id'); $loai_audio_id->setLabel('Loại (*)')->addMultiOptions($cateOptions)->setDecorators(array('ViewHelper', 'Errors', array(array('data' => 'HtmlTag'), array('tag' => 'td')), array('Label', array('tag' => 'td')), array(array('row' => 'HtmlTag'), array('tag' => 'tr'))))->setAttrib('class', 'text-input'); $noi_dung = new Zend_Form_Element_Textarea('noi_dung'); $noi_dung->setLabel('Nội dung (*)')->setRequired(true)->addValidator('NotEmpty')->setDecorators(array('ViewHelper', 'Errors', array(array('data' => 'HtmlTag'), array('tag' => 'td')), array('Label', array('tag' => 'td')), array(array('row' => 'HtmlTag'), array('tag' => 'tr'))))->setAttribs(array('id' => 'noi_dung', 'class' => 'text-input textarea')); $soundcloud_embed = new Zend_Form_Element_Text('soundcloud_embed'); $soundcloud_embed->setLabel('Embed SoundCloud')->setDescription('How to get SoundCloud embed code? <a href="http://help.soundcloud.com/customer/portal/articles/243751-how-can-i-put-my-track-or-playlist-on-my-site-or-blog-" target="_blank">Click here</a>')->setDecorators(array('ViewHelper', 'Errors', array('Description', array('tag' => 'div', 'escape' => false, 'placement' => 'append')), array(array('data' => 'HtmlTag'), array('tag' => 'td', 'style' => 'width: 90%')), array('Label', array('tag' => 'td')), array(array('row' => 'HtmlTag'), array('tag' => 'tr'))))->setAttrib('class', 'text-input large-input'); $statusOptions = array("multiOptions" => Default_Model_Constraints::trang_thai()); $trang_thai = new Zend_Form_Element_Radio('trang_thai', $statusOptions); $trang_thai->setRequired(true)->setLabel('Trạng thái')->setValue('1')->setSeparator('')->setDecorators(array('ViewHelper', 'Errors', array(array('data' => 'HtmlTag'), array('tag' => 'td')), array('Label', array('tag' => 'td')), array(array('row' => 'HtmlTag'), array('tag' => 'tr')))); $submitCon = new Zend_Form_Element_Submit('submitCon'); $submitCon->setDecorators(array('ViewHelper', array(array('data' => 'HtmlTag'), array('tag' => 'span')), array(array('row' => 'HtmlTag'), array('tag' => 'span'))))->setAttribs(array('class' => 'button')); $submitExit = new Zend_Form_Element_Submit('submitExit'); $submitExit->setDecorators(array('ViewHelper', array(array('data' => 'HtmlTag'), array('tag' => 'span')), array(array('row' => 'HtmlTag'), array('tag' => 'span'))))->setAttribs(array('class' => 'button')); $cancel = new Zend_Form_Element_Button('cancel'); $cancel->setDecorators(array('ViewHelper', array(array('data' => 'HtmlTag'), array('tag' => 'span')), array(array('row' => 'HtmlTag'), array('tag' => 'span'))))->setAttribs(array('class' => 'button', 'onclick' => 'window.location.href="' . $_SERVER['HTTP_REFERER'] . '"')); $this->addElements(array($tieu_de, $loai_audio_id, $noi_dung, $soundcloud_embed, $trang_thai, $submitCon, $submitExit, $cancel)); $this->addDisplayGroup(array('submitCon', 'submitExit', 'cancel'), 'submit', array('decorators' => array('FormElements', array(array('data' => 'HtmlTag'), array('tag' => 'td', 'colspan' => 2)), array(array('row' => 'HtmlTag'), array('tag' => 'td'))))); $this->setDecorators(array('FormElements', array('HtmlTag', array('tag' => 'table')), 'Form')); }
public function checkRequire() { try { $subject = Khcn_Api::_()->default()->getSubject(); } catch (Exception $e) { $subject = null; } $actionName = $this->getFrontController()->getRequest()->getActionName(); $ret = true; if (!$subject instanceof Khcn_Model_Item_Abstract || !$subject->getIdentity()) { $ret = false; } else { if (null !== $this->_requiredType && $subject->getType() != $this->_requiredType) { $ret = false; } else { if (null !== ($requireType = $this->getActionRequireType($actionName)) && $subject->getType() != $requireType) { $ret = false; } } } if (!$ret && APPLICATION_ENV == 'development' && Zend_Registry::isRegistered('Zend_Log') && ($log = Zend_Registry::get('Zend_Log')) instanceof Zend_Log) { $target = $this->getRequest()->getModuleName() . '.' . $this->getRequest()->getControllerName() . '.' . $this->getRequest()->getActionName(); $log->log('Require class ' . get_class($this) . ' failed check for: ' . $target, Zend_Log::DEBUG); } return $ret; }
/** * Gets the specified permission for the context * * @param Core_Model_Item_Abstract|string $resource The resource type or object that is being accessed * @param Core_Model_Item_Abstract $role The item (user) performing the action * @param string $action The name of the action being performed * @return mixed 0/1 for allowed, or data for settings */ public function isAllowed($resource, $role, $action = 'view') { if (null === $resource) { return false; } if (null === $role) { $viewer = Khcn_Api::_()->getViewer(); if (null !== $viewer && $viewer->getIdentity()) { $role = $viewer; } else { $role = 'everyone'; } } if (!is_string($action)) { throw new Khcn_Api_Exception('action must be a string'); } // Iterate over each adapter and check permission $final = Default_Model_DbTable_Permissions::LEVEL_DISALLOW; $adapter = Khcn_Api::_()->getDbtable('permissions', 'default'); $result = $adapter->isAllowed($resource, $role, $action); switch ($result) { // Unknown value, ignore, nonboolean case Default_Model_DbTable_Permissions::LEVEL_DISALLOW: return Default_Model_DbTable_Permissions::LEVEL_DISALLOW; break; case Default_Model_DbTable_Permissions::LEVEL_MODERATE: return Default_Model_DbTable_Permissions::LEVEL_ALLOW; break; case Default_Model_DbTable_Permissions::LEVEL_ALLOW: $final = Default_Model_DbTable_Permissions::LEVEL_ALLOW; break; } return $final; }
public function gopYAction() { // Set up require's $this->view->viewer = $viewer = Khcn_Api::_()->getViewer(); if (!$this->_helper->requireUser()->isValid()) { return; } $table = Khcn_Api::_()->getDbTable('gop_y', 'default'); $this->view->form = $form = new Default_Form_HopThu_GopY(); if (!$this->getRequest()->isPost()) { return; } if (!$form->isValid($this->getRequest()->getPost())) { return; } $db = $table->getAdapter(); $db->beginTransaction(); try { $values = $form->getValues(); $gop_y = $table->createRow(); $gop_y->nguoi_dung_id = $viewer->getIdentity(); $gop_y->loai_id = $values['loai_id']; $gop_y->ten = $values['ten']; $gop_y->mo_ta = $values['mo_ta']; $gop_y->ngay_tao = date('Y-m-d H:i:s'); $gop_y->save(); $db->commit(); return $this->_forward('thong-bao', 'index', 'default', array('messages' => array(Zend_Registry::get('Zend_Translate')->_("Thành công. Cảm ơn bạn đã góp ý cho chúng tôi.")))); } catch (Exception $e) { $db->rollBack(); throw $e; } }
public function init() { $this->setName('f2')->setMethod('post'); $ten = new Zend_Form_Element_Text('ten'); $ten->setLabel('Tên (*)')->setRequired(true)->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty')->addValidator(new Zend_Validate_StringLength(0, 255))->setDecorators(array('ViewHelper', 'Errors', array(array('data' => 'HtmlTag'), array('tag' => 'td', 'style' => 'width: 85%')), array('Label', array('tag' => 'td')), array(array('row' => 'HtmlTag'), array('tag' => 'tr'))))->setAttribs(array('class' => 'text-input medium-input')); $statusOptions = array("multiOptions" => array(1 => 'Thuộc SGU', 0 => 'Liên kết trang mạng')); $is_sgu = new Zend_Form_Element_Radio('is_sgu', $statusOptions); $is_sgu->setRequired(true)->setLabel('Liên kết')->setValue('1')->setSeparator('')->setDecorators(array('ViewHelper', 'Errors', array(array('data' => 'HtmlTag'), array('tag' => 'td')), array('Label', array('tag' => 'td')), array(array('row' => 'HtmlTag'), array('tag' => 'tr')))); $url = new Zend_Form_Element_Text('url'); $url->setLabel('Url (*)')->setRequired(true)->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty')->addValidator(new Zend_Validate_StringLength(0, 255))->setDecorators(array('ViewHelper', 'Errors', array(array('data' => 'HtmlTag'), array('tag' => 'td')), array('Label', array('tag' => 'td')), array(array('row' => 'HtmlTag'), array('tag' => 'tr'))))->setAttrib('class', 'text-input medium-input'); $file = new Zend_Form_Element_File('file'); $file->setLabel('Upload hình')->setDescription('(*.jgp, *.gif, *.png , < 10MB )')->setDestination(BASE_PATH . '/upload/small/images/lien_ket')->addValidator(new Zend_Validate_File_Extension(array('jpg,gif,png')))->addValidator(new Zend_Validate_File_FilesSize(array('min' => 1, 'max' => 10485760, 'bytestring' => true)))->setDecorators(array('File', 'Errors', array('Description', array('escape' => false, 'tag' => 'div', 'placement' => 'append')), array('HtmlTag', array('tag' => 'td')), array('Label', array('tag' => 'td')), array(array('row' => 'HtmlTag'), array('tag' => 'tr')))); $maxOrder = Khcn_Api::_()->getDbTable('lien_ket', 'default')->getMaxOrderItem(); $order = new Zend_Form_Element_Text('order'); $order->setLabel('Thứ tự *')->setValue($maxOrder->order + 1)->addValidator(new Zend_Validate_Int())->setDecorators(array('ViewHelper', 'Errors', array(array('data' => 'HtmlTag'), array('tag' => 'td', 'style' => 'width: 85%')), array('Label', array('tag' => 'td')), array(array('row' => 'HtmlTag'), array('tag' => 'tr'))))->setAttribs(array('class' => 'text-input tinysmall-input')); $submitCon = new Zend_Form_Element_Submit('submitCon'); $submitCon->setDecorators(array('ViewHelper', array(array('data' => 'HtmlTag'), array('tag' => 'span')), array(array('row' => 'HtmlTag'), array('tag' => 'span'))))->setAttribs(array('class' => 'button')); $submitExit = new Zend_Form_Element_Submit('submitExit'); $submitExit->setDecorators(array('ViewHelper', array(array('data' => 'HtmlTag'), array('tag' => 'span')), array(array('row' => 'HtmlTag'), array('tag' => 'span'))))->setAttribs(array('class' => 'button')); $Url = new Zend_View_Helper_Url(); $link = $Url->url(array('module' => 'admin', 'controller' => 'lien-ket', 'action' => 'index'), null, true); $cancel = new Zend_Form_Element_Button('cancel'); $cancel->setDecorators(array('ViewHelper', array(array('data' => 'HtmlTag'), array('tag' => 'span')), array(array('row' => 'HtmlTag'), array('tag' => 'span'))))->setAttribs(array('class' => 'button', 'onclick' => 'window.location.href="' . $link . '"')); $this->addElements(array($ten, $is_sgu, $url, $file, $order, $submitCon, $submitExit, $cancel)); $this->addDisplayGroup(array('submitCon', 'submitExit', 'cancel'), 'submit', array('decorators' => array('FormElements', array(array('data' => 'HtmlTag'), array('tag' => 'td', 'colspan' => 2)), array(array('row' => 'HtmlTag'), array('tag' => 'td')), array('HtmlTag', array('tag' => 'tr', 'id' => 'btn'))))); $this->setDecorators(array('FormElements', array('HtmlTag', array('tag' => 'table', 'class' => 'lien_ket')), 'Form')); }
public function init() { $this->setName('f2')->setAttrib('class', 'form_create_nhan_su'); $ho_ten = new Zend_Form_Element_Text('ho_ten'); $ho_ten->setLabel('Họ tên (*)')->setRequired(true)->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty')->setDecorators(array('ViewHelper', 'Errors', array(array('data' => 'HtmlTag'), array('tag' => 'td', 'style' => 'width: 85%')), array('Label', array('tag' => 'td')), array(array('row' => 'HtmlTag'), array('tag' => 'tr'))))->setAttrib('class', 'text-input medium-input'); $chuc_vu = new Zend_Form_Element_Text('chuc_vu'); $chuc_vu->setLabel('Chức vụ')->setDecorators(array('ViewHelper', 'Errors', array(array('data' => 'HtmlTag'), array('tag' => 'td', 'style' => 'width: 85%')), array('Label', array('tag' => 'td')), array(array('row' => 'HtmlTag'), array('tag' => 'tr'))))->setAttrib('class', 'text-input medium-input'); $email = new Zend_Form_Element_Text('email'); $email->setLabel('Email')->setDecorators(array('ViewHelper', 'Errors', array(array('data' => 'HtmlTag'), array('tag' => 'td', 'style' => 'width: 85%')), array('Label', array('tag' => 'td')), array(array('row' => 'HtmlTag'), array('tag' => 'tr'))))->setAttrib('class', 'text-input medium-input'); $website = new Zend_Form_Element_Text('website'); $website->setLabel('Website')->setDecorators(array('ViewHelper', 'Errors', array(array('data' => 'HtmlTag'), array('tag' => 'td', 'style' => 'width: 85%')), array('Label', array('tag' => 'td')), array(array('row' => 'HtmlTag'), array('tag' => 'tr'))))->setAttrib('class', 'text-input medium-input'); $so_dien_thoai = new Zend_Form_Element_Text('so_dien_thoai'); $so_dien_thoai->setLabel('Số điện thoại')->setDecorators(array('ViewHelper', 'Errors', array(array('data' => 'HtmlTag'), array('tag' => 'td', 'style' => 'width: 85%')), array('Label', array('tag' => 'td')), array(array('row' => 'HtmlTag'), array('tag' => 'tr'))))->setAttrib('class', 'text-input medium-input'); $file = new Zend_Form_Element_File('file'); $file->setLabel('Ảnh cá nhân')->setDescription('(*.jgp, *.gif, *.png , < 10MB )')->setDestination(BASE_PATH . '/upload/files/nhan_su/')->addValidator(new Zend_Validate_File_Extension(array('jpg,gif,png')))->addValidator(new Zend_Validate_File_FilesSize(array('min' => 1, 'max' => 10485760, 'bytestring' => true)))->setDecorators(array('File', 'Errors', array('Description', array('escape' => false, 'tag' => 'div', 'placement' => 'append')), array('HtmlTag', array('tag' => 'td')), array('Label', array('tag' => 'td')), array(array('row' => 'HtmlTag'), array('tag' => 'tr')))); $maxOrder = Khcn_Api::_()->getDbTable('nhan_su', 'default')->getMaxOrder(); $order = new Zend_Form_Element_Text('order'); $order->setLabel('Số thứ tự')->setValue($maxOrder)->setDecorators(array('ViewHelper', 'Errors', array(array('data' => 'HtmlTag'), array('tag' => 'td', 'style' => 'width: 85%')), array('Label', array('tag' => 'td')), array(array('row' => 'HtmlTag'), array('tag' => 'tr'))))->setAttrib('class', 'text-input tinysmall-input'); $submit = new Zend_Form_Element_Submit('submit'); $submit->setLabel('Lưu')->setDecorators(array('ViewHelper', array(array('data' => 'HtmlTag'), array('tag' => 'span')), array(array('row' => 'HtmlTag'), array('tag' => 'span'))))->setAttribs(array('class' => 'button')); $url = new Zend_View_Helper_Url(); $link = $url->url(array('module' => 'admin', 'controller' => 'gioi-thieu', 'action' => 'nhan-su'), null, true); $cancel = new Zend_Form_Element_Button('cancel'); $cancel->setLabel('Không lưu')->setDecorators(array('ViewHelper', array(array('data' => 'HtmlTag'), array('tag' => 'span')), array(array('row' => 'HtmlTag'), array('tag' => 'span'))))->setAttribs(array('class' => 'button', 'onclick' => 'window.location.href="' . $link . '"')); $this->addElements(array($ho_ten, $chuc_vu, $email, $website, $so_dien_thoai, $file, $order, $submit, $cancel)); $this->addDisplayGroup(array('submit', 'cancel'), 'submitbtn', array('decorators' => array('FormElements', array(array('data' => 'HtmlTag'), array('tag' => 'td', 'colspan' => 2)), array(array('row' => 'HtmlTag'), array('tag' => 'td'))))); $this->setDecorators(array('FormElements', array('HtmlTag', array('tag' => 'table')), 'Form')); }
public function getAvailableTypes() { if (null === $this->_types) { $this->_types = Khcn_Api::_()->getDbtable('search', 'default')->getAdapter()->query('SELECT DISTINCT `type` FROM `search`')->fetchAll(Zend_Db::FETCH_COLUMN); } return $this->_types; }
public function isNew() { $thong_bao_moi = Khcn_Api::_()->getApi('settings', 'default')->getSetting('thong_bao_moi', 10); if (strtotime($this->ngay_tao) > strtotime("-{$thong_bao_moi} days")) { return true; } return false; }
public function chiTietAction() { $id = $this->getRequest()->getParam('id'); $this->view->chuong_trinh = $chuong_trinh = Khcn_Api::_()->getItem('default_chuong_trinh', $id); if (!$chuong_trinh) { return $this->_helper->requireSubject()->forward(); } }
public function chiTietAction() { $id = $this->getRequest()->getParam('id'); $this->view->tai_lieu = $tai_lieu = Khcn_Api::_()->getItem('default_tai_lieu', $id); if (!$tai_lieu) { return $this->_helper->requireSubject()->forward(); } }
/** * Pre-delete hook. If overridden, should be called at end of function. * * @return void */ protected function _delete() { $hinhAnhs = Khcn_Api::_()->getDbTable('hinh_anh_chuyen_de', 'default')->getHinhAnhByChuyenDe($this->getIdentity()); foreach ($hinhAnhs as $hinh_anh) { $hinh_anh->delete(); } parent::_delete(); }
public function init() { $this->setName('form_giang_vien_ncs')->setMethod('post')->setAttrib('class', 'global_form'); $this->addElement('Heading', 'account', array('value' => 'Thông tin cá nhân')); $this->account->removeDecorator('Label')->removeDecorator('HtmlTag')->getDecorator('HtmlTag2')->setOption('class', 'form-wrapper-heading'); $viewer = Khcn_Api::_()->getViewer(); $this->addElement('Text', 'ho_ten', array('label' => 'Họ và tên (*)', 'allowEmpty' => false, 'required' => true, 'filters' => array('StripTags'), 'value' => $viewer->getDisplayname())); $this->addElement('Calendar', 'ngay_sinh', array('label' => 'Ngày tháng năm sinh')); $don_vi = new Default_Model_DonVi(); $this->addElement('Select', 'ma_don_vi', array('label' => 'Đơn vị công tác(*)', 'multiOptions' => $don_vi->getDSDVSGU(), 'value' => 1)); $this->addElement('Text', 'ten_luan_an', array('label' => 'Tên luận án *', 'allowEmpty' => false, 'required' => true, 'filters' => array('StripTags'))); $this->addElement('Text', 'chuyen_nganh_dao_tao', array('label' => 'Chuyên ngành đào tạo')); $this->addElement('Text', 'co_so_dao_tao', array('label' => 'Cơ sở đào tạo')); $this->addElement('Heading', 'thoi_gian_dao_tao', array('label' => 'Thời gian đào tạo')); $this->addElement('Calendar', 'tgdt_from', array('label' => 'Từ', 'calendarOptions' => array('yearRangeCount' => 10))); $this->addElement('Calendar', 'tgdt_to', array('label' => 'Đến', 'calendarOptions' => array('yearRangeCount' => 10))); $this->addElement('Heading', 'qd_ncs', array('value' => 'Quyết định công nhận Nghiên cứu sinh')); $this->qd_ncs->removeDecorator('Label')->removeDecorator('HtmlTag')->getDecorator('HtmlTag2')->setOption('class', 'form-wrapper-heading'); $this->addElement('Text', 'ncs_so', array('label' => 'Số')); $this->addElement('Calendar', 'ngay_ky', array('label' => 'Ký ngày', 'calendarOptions' => array('yearRangeCount' => 10))); $this->addElement('Text', 'nguoi_ky', array('label' => 'Người ký')); $this->addElement('Heading', 'ke_hoach_bao_ve_chuyen_de', array('value' => 'Kế hoạch bảo vệ chuyên đề')); $this->ke_hoach_bao_ve_chuyen_de->removeDecorator('Label')->removeDecorator('HtmlTag')->getDecorator('HtmlTag2')->setOption('class', 'form-wrapper-heading'); $this->addElement('Heading', 'chuyen_de_1', array('label' => 'Chuyên đề 1')); $this->addElement('Calendar', 'thoi_gian_chuyen_de_1', array('label' => 'Thời gian', 'calendarOptions' => array('yearRangeCount' => 10), 'attribs' => array('name' => 'thoi_gian_chuyen_de[]'))); $this->addElement('Text', 'ten_chuyen_de_1', array('label' => 'Tên chuyên đề', 'attribs' => array('name' => 'ten_chuyen_de[]'))); $this->addElement('Hidden', 'tong_chuyen_de', array('value' => 1)); $this->addElement('Dummy', 'them_chuyen_de', array('content' => '<a href="javascript:void(0)" onclick="themChuyenDe()" id="them_chuyen_de">Thêm chuyên đề</a> <a href="javascript:void(0)" onclick="xoaChuyenDe()" id="xoa_chuyen_de" style="display: none;">Xóa chuyên đề</a>')); $this->addElement('Heading', 'ke_hoach_bao_ve_luan_an', array('value' => 'Kế hoạch bảo vệ luận án')); $this->ke_hoach_bao_ve_luan_an->removeDecorator('Label')->removeDecorator('HtmlTag')->getDecorator('HtmlTag2')->setOption('class', 'form-wrapper-heading'); $this->addElement('Dummy', 'bvla_cap_bo_mon', array('content' => 'Dự kiến kế hoạch bảo về luận án cấp bộ môn')); $this->addElement('Calendar', 'thoi_gian_bvla_cap_bo_mon', array('label' => 'Thời gian', 'calendarOptions' => array('yearRangeCount' => 10))); $this->addElement('Text', 'dia_diem_bvla_cap_bo_mon', array('label' => 'Địa điểm')); $this->addElement('Dummy', 'bvla_cap_truong', array('content' => 'Dự kiến kế hoạch bảo về luận án cấp trường')); $this->addElement('Calendar', 'thoi_gian_bvla_cap_truong', array('label' => 'Thời gian', 'calendarOptions' => array('yearRangeCount' => 10))); $this->addElement('Text', 'dia_diem_bvla_cap_truong', array('label' => 'Địa điểm')); $this->addElement('Heading', 'bai_bao_ctkh', array('value' => 'Bài báo/công trình khoa học đã công bố')); $this->bai_bao_ctkh->removeDecorator('Label')->removeDecorator('HtmlTag')->getDecorator('HtmlTag2')->setOption('class', 'form-wrapper-heading'); $this->addElement('Text', 'ten_san_pham', array('label' => 'Tên sản phẩm')); $this->addElement('Textarea', 'phuong_thuc_pho_bien', array('label' => 'Phương thức phổ biến')); $this->addElement('Dummy', 'phuong_thuc_pho_bien_luu_y', array('content' => '*Lưu ý: </br>- Đối với Tạp chí cần nêu rõ xếp loại tạp chí (SCI, SCIE…); Số kỳ, thời gian phát hành… </br>- Đối với Kỷ yếu Hội thảo cần nêu rõ: Quy mô của Hội thảo; Hình thức phát hành kỷ yếu (Bài viết có phản biện…), có báo cáo tại Hội thảo hay không? ')); $this->addElement('Heading', 'ket_qua_bao_ve_luan_an', array('value' => 'Kết quả bảo vệ luận văn/luận án')); $this->ket_qua_bao_ve_luan_an->removeDecorator('Label')->removeDecorator('HtmlTag')->getDecorator('HtmlTag2')->setOption('class', 'form-wrapper-heading'); $this->addElement('Calendar', 'thoi_gian_bao_ve', array('label' => 'Thời gian', 'calendarOptions' => array('yearRangeCount' => 10))); $this->addElement('Text', 'dia_diem_bao_ve', array('label' => 'Địa điểm')); $this->addElement('Text', 'ket_qua_bao_ve', array('label' => 'Kết quả')); $this->addElement('Dummy', 'ho_so_nop_cho_phong_qlkhsdh', array('content' => "<strong>Hồ sơ nộp cho Phòng QLKH-SĐH:</strong></br>\n\t\t\t- Văn bản luận án đóng thành tập: 1 cuốn;</br>\n\t\t\t- Đĩa CD chứa nội dung luận án: 1 đĩa;</br>\n\t\t\t- Văn bản liên quan:</br>\n\t\t\t<span style='margin-left: 20px'>+ Quyết định bảo vệ của cơ sở đào tạo;</span></br>\n\t\t\t<span style='margin-left: 20px'>+ Giấy chứng nhận đã bảo về luận án.</span>")); $this->addElement('Heading', 'y_kien_ncs_heading', array('value' => 'Các ý kiến của Nghiên cứu sinh (nếu có)')); $this->y_kien_ncs_heading->removeDecorator('Label')->removeDecorator('HtmlTag')->getDecorator('HtmlTag2')->setOption('class', 'form-wrapper-heading'); $this->addElement('Textarea', 'y_kien_ncs', array()); $this->addElement('Button', 'submit', array('label' => 'Lưu', 'type' => 'submit', 'ignore' => true, 'decorators' => array('ViewHelper'), 'attribs' => array('class' => 'art-button'))); $url = new Zend_View_Helper_Url(); $link = $url->url(array('module' => 'default', 'controller' => 'index', 'action' => 'index')); $this->addElement('Cancel', 'cancel', array('label' => 'Không lưu', 'onclick' => 'window.location.href="' . $link . '"', 'decorators' => array('ViewHelper'), 'attribs' => array('class' => 'art-button'))); $this->addDisplayGroup(array('submit', 'cancel'), 'submitbtn'); }
public function chiTietAction() { $id = $this->getRequest()->getParam('id'); $this->view->sinh_hoat_chuyen_de = $sinh_hoat_chuyen_de = Khcn_Api::_()->getItem('default_sinh_hoat_chuyen_de', $id); if (!$sinh_hoat_chuyen_de) { return $this->_helper->requireSubject()->forward(); } $this->view->hinhAnhs = $hinhAnhs = Khcn_Api::_()->getDbTable('hinh_anh_chuyen_de', 'default')->getHinhAnhByChuyenDe($sinh_hoat_chuyen_de->getIdentity()); }
public function chiTietAction() { $id = $this->getRequest()->getParam('id'); $this->view->bai_bao = $bai_bao = Khcn_Api::_()->getItem('default_bai_bao', $id); if (!$bai_bao) { return $this->_helper->requireSubject()->forward(); } $this->view->giangViens = $bai_bao->getGiangViens(); }
public function chiTietAction() { $id = $this->getRequest()->getParam('id'); $this->view->hoi_thao = $hoi_thao = Khcn_Api::_()->getItem('default_hoi_thao', $id); if (!$hoi_thao) { return $this->_helper->requireSubject()->forward(); } $this->view->capQLs = $capQLs = Default_Model_Constraints::hoithao_capquanly(); }
public function danhSachAction() { // TODO Auto-generated {0}::indexAction() default action $ma_loai = $this->getRequest()->getParam('ma_loai'); $this->view->loai_hs = $loai_hs = Khcn_Api::_()->getItem('default_loai_ho_so', $ma_loai); if (!$loai_hs) { $this->_redirect('index'); } $this->view->danhSachHs = Khcn_Api::_()->getDbTable('ho_so', 'default')->getHSsByLoai($ma_loai); }
public function chiTietAction() { $id = $this->getRequest()->getParam('id'); $this->view->lich_ct = $lich_ct = Khcn_Api::_()->getItem('default_lich_cong_tac', $id); if (!$lich_ct) { return $this->_redirect('lich-cong-tac/index'); } $this->view->ndcts = $ndcts = $lich_ct->getFullNDCTs(); $this->view->thus = Default_Model_Constraints::lct_thu(); }
public function getAuthRole() { if (is_null($this->_authRole)) { $viewer = Khcn_Api::_()->getViewer(); if ($viewer && $viewer->getIdentity()) { $this->_authRole = $viewer; } } return $this->_authRole; }
public function __wakeup() { try { $table = Khcn_Api::_()->loadClass($this->_tableClass); $this->_table = $table; $this->_connected = true; } catch (Exception $e) { $this->_connected = false; } }
public function getNguoiDungByMaGiangVien($ma_giang_vien) { $tableGV = Khcn_Api::_()->getDbTable('giang_vien', 'default'); $selectGV = $tableGV->select()->where('ma = ?', $ma_giang_vien); $rowGV = $tableGV->fetchRow($selectGV); if ($rowGV === null) { return null; } $select = $this->select()->where('giang_vien_id = ?', $rowGV->getIdentity())->limit(1); return $this->fetchRow($select); }
public function checkRequire() { // @todo admin stuff $ret = false; $ret = Khcn_Api::_()->getApi('authorization', 'default')->isAllowed('admin', null, 'view'); if (!$ret && APPLICATION_ENV == 'development' && Zend_Registry::isRegistered('Zend_Log') && ($log = Zend_Registry::get('Zend_Log')) instanceof Zend_Log) { $target = $this->getRequest()->getModuleName() . '.' . $this->getRequest()->getControllerName() . '.' . $this->getRequest()->getActionName(); $log->log('Require class ' . get_class($this) . ' failed check for: ' . $target, Zend_Log::DEBUG); } return $ret; }
public function danhSachAction() { // TODO Auto-generated {0}::indexAction() default action $id = $this->getRequest()->getParam('loai'); $this->view->loai_bm = $loai_bm = Khcn_Api::_()->getItem('default_loai_bieu_mau', $id); if (!$loai_bm) { $this->_redirect('bieu-mau/index'); } $this->view->lists = $loai_bm->getDanhSachBieuMau(); $this->view->childs = $childs = Khcn_Api::_()->getDbTable('loai_bieu_mau', 'default')->getByParent($loai_bm->getIdentity()); }
public function dsLienKetTrong() { $params = array(); $params['is_sgu'] = 1; $result = Khcn_Api::_()->getDbTable('lien_ket', 'default')->getLienKets($params); $str = '<ul>'; foreach ($result as $lien_ket) { $str .= '<li><a class="Normal" href="' . $lien_ket['url'] . '" target="_blank">' . $lien_ket['ten'] . '</a></li>'; } $str .= '</ul>'; return $str; }
public function dsLichCT() { $lichCTs = Khcn_Api::_()->getDbTable('lich_cong_tac', 'default')->getLichCTs(array('trang_thai' => 1, 'limit' => 5)); $link = new Zend_View_Helper_Url(); $str = '<ul>'; foreach ($lichCTs as $lichCT) { $url = $link->url(array('controller' => 'lich-cong-tac', 'action' => 'chi-tiet', 'id' => $lichCT['id']), null, true); $str .= '<li><a class="Normal" href="' . $url . '">Tuần ' . $lichCT['tuan'] . ' tháng ' . $lichCT['thang'] . ' (' . date('d/m/Y', strtotime($lichCT['ngay_bat_dau'])) . ' - ' . date('d/m/Y', strtotime($lichCT['ngay_ket_thuc'])) . ')</a></li>'; } $str .= '</ul>'; return $str; }
public function init() { $this->setAttrib('class', 'global_form form_hop_thu_gop_y'); $cateOptions = Khcn_Api::_()->getDbTable('loai_gy', 'default')->getLoaiGYAssoc(); $this->addElement('Select', 'loai_id', array('label' => 'Loại', 'multiOptions' => $cateOptions)); $this->addElement('Text', 'ten', array('label' => 'Chủ đề', 'allowEmpty' => false, 'required' => true, 'filters' => array('StripTags'))); $this->addElement('Textarea', 'mo_ta', array('label' => 'Mô tả', 'allowEmpty' => false, 'required' => true, 'filters' => array('StripTags'))); $this->addElement('Button', 'submit', array('label' => 'Góp Ý', 'type' => 'submit', 'ignore' => true, 'decorators' => array('ViewHelper'), 'attribs' => array('class' => 'art-button'))); $url = new Zend_View_Helper_Url(); $link = $url->url(array('module' => 'default', 'controller' => 'index', 'action' => 'index')); $this->addElement('Cancel', 'cancel', array('label' => 'Hủy', 'onclick' => 'window.location.href="' . $link . '"', 'decorators' => array('ViewHelper'), 'attribs' => array('class' => 'art-button'))); $this->addDisplayGroup(array('submit', 'cancel'), 'submitbtn'); }
private function updateSlideshow() { $hinhAnhs = Khcn_Api::_()->getDbTable('hinh_anh', 'default')->getSlideshow(); $text = '<photos>'; foreach ($hinhAnhs as $hinhAnh) { $text .= '<photo image="images/' . $hinhAnh->ten_file . '" colorboxImage="images/' . $hinhAnh->ten_file . '" colorboxInfo="" colorboxClass="image" url="" target="_blank"><![CDATA[<head></head><body></body>]]></photo>'; } $text .= '</photos>'; $path = BASE_PATH . '/flash/image-scroller/images.xml'; $fp = fopen($path, 'w'); fwrite($fp, $text); fclose($fp); }
public function init() { $this->setName('f3')->setMethod('get'); $dv = Khcn_Api::_()->getDbTable('don_vi', 'default')->getDonVisAssoc(); $dvOptions = array("multiOptions" => $dv); $don_vi_id = new Zend_Form_Element_Select('don_vi_id', $dvOptions); $don_vi_id->setRequired(true)->setLabel('Đơn vị')->setSeparator('')->setDecorators(array('ViewHelper', 'Errors', array(array('data' => 'HtmlTag'), array('tag' => 'td')), array('Label', array('tag' => 'span')), array(array('row' => 'HtmlTag'), array('tag' => 'td'))))->setAttribs(array('id' => 'don_vi_id')); $submit = new Zend_Form_Element_Button('loc', array('type' => 'submit')); $submit->setLabel('Lọc')->setDecorators(array('ViewHelper', array(array('data' => 'HtmlTag'), array('tag' => 'span')), array(array('row' => 'HtmlTag'), array('tag' => 'td', 'class' => 'filter_btn_l'))))->setAttribs(array('class' => 'button')); $this->addElements(array($don_vi_id, $submit)); $this->addDisplayGroup(array('don_vi_id', 'loc'), 'filter', array('order' => '0', 'decorators' => array('FormElements', array('HtmlTag', array('tag' => 'tr', 'align' => 'left', 'class' => 'text'))))); $this->setDecorators(array('FormElements', array('HtmlTag', array('tag' => 'table', 'class' => 'filter_bm', 'style' => 'width : 47%')), 'Form')); }