Example #1
0
 public function getPhotoUrl($type = null)
 {
     if (empty($this->ten_file)) {
         return Khcn_View_Helper_GetBaseUrl::getBaseUrl() . '/images/nophoto_user.png';
     }
     return parent::getPhotoUrl($type);
 }
Example #2
0
 public function thongKeTruyCap()
 {
     $bo_dem = new Default_Model_BoDem();
     //Tong so lan truy cap
     $so_luong = $bo_dem->tong_luot_truy_cap();
     $str_soluong = strval($so_luong);
     $n_soluong = strlen($str_soluong);
     $temp = '0000000';
     $str_cut = substr($temp, 0, 7 - $n_soluong);
     $str_soluong = $str_cut . $str_soluong;
     $html = '<p style="text-align: center;">';
     for ($i = 0; $i < 7; $i++) {
         $html .= '<img src="' . Khcn_View_Helper_GetBaseUrl::getBaseUrl() . '/images/counter/mechanical/' . $str_soluong[$i] . '.gif" alt="">';
     }
     $html .= '</p>';
     $html .= '<table><body>';
     $html .= '<tr>';
     $html .= '<td class="now">Hôm nay</td>';
     $html .= '<td class="r">' . $bo_dem->so_luong_hom_nay() . '</td>';
     $html .= '</tr>';
     $html .= '<tr>';
     $html .= '<td class="week">Tuần này</td>';
     $html .= '<td class="r">' . $bo_dem->so_luong_tuan_nay() . '</td>';
     $html .= '</tr>';
     $html .= '<tr>';
     $html .= '<td class="month">Tháng này</td>';
     $html .= '<td class="r">' . $bo_dem->so_luong_thang_nay() . '</td>';
     $html .= '</tr>';
     $html .= '<tr>';
     $html .= '<td class="all">Tất cả</td>';
     $html .= '<td class="r">' . $bo_dem->tong_luot_truy_cap() . '</td>';
     $html .= '</tr>';
     $html .= '</body></table>';
     return $html;
 }
Example #3
0
 public function init()
 {
     $this->setName('search')->setMethod('get')->setAction(Khcn_View_Helper_GetBaseUrl::getBaseUrl() . '/index/search');
     $keyWord = new Zend_Form_Element_Text('keyword');
     $keyWord->setLabel('Từ khóa : ')->setRequired(true)->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty')->setDecorators(array('ViewHelper', 'Errors', array(array('data' => 'HtmlTag'), array('tag' => 'tr', 'class' => 'SubHead')), array('Label', array('tag' => 'tr')), array(array('row' => 'HtmlTag'), array('tag' => 'tr'))));
     $keyWord->setAttribs(array('style' => 'width : 195px;'));
     $submit = new Zend_Form_Element_Submit('submit');
     $submit->setLabel('Tìm')->setDecorators(array('ViewHelper', array(array('data' => 'HtmlTag'), array('tag' => 'td', 'colspan' => '2', 'align' => 'left')), array(array('row' => 'HtmlTag'), array('tag' => 'tr', 'class' => 'btnsm'))))->setAttribs(array('class' => 'art-button'));
     $this->addElements(array($keyWord, $submit));
     $this->setDecorators(array('FormElements', array('HtmlTag', array('tag' => 'table')), 'Form'));
 }
Example #4
0
    public function message()
    {
        $str = '';
        if (isset($_SESSION['msg'])) {
            $str = '<div class="notification ' . $_SESSION['type_msg'] . ' png_bg">
					<a href="#" class="close"><img src="' . Khcn_View_Helper_GetBaseUrl::getBaseUrl() . '/../application/templates/admin/images/icons/cross_grey_small.png" title="Close this notification" alt="close" /></a>
					<div>' . $_SESSION['msg'] . '</div>
				  </div>';
            unset($_SESSION['msg']);
        }
        return $str;
    }
Example #5
0
 public function init()
 {
     $this->setName('form_search_gv')->setMethod('get')->setAction(Khcn_View_Helper_GetBaseUrl::getBaseUrl() . '/index/search');
     $this->addElement('Text', 'name', array('label' => 'Họ tên : ', 'allowEmpty' => false, 'required' => true, 'filters' => array('StripTags')));
     $don_vi = new Default_Model_DonVi();
     $dv = $don_vi->getDSDV();
     unset($dv['1']);
     $dv = array('0' => '=============== Tất cả ===============') + $dv;
     $this->addElement('Select', 'ma_don_vi', array('label' => 'Đơn vị : ', 'multiOptions' => $dv));
     // Element: submit
     $this->addElement('Button', 'submit', array('label' => 'Tìm kiếm', 'type' => 'submit'));
 }
Example #6
0
 public function init()
 {
     $this->setName('f3')->setAttrib('enctype', 'multipart/form-data')->setMethod('post')->setAttribs(array('onsubmit' => 'return kiem_tra()', 'name' => 'f3'));
     $baseUrl = Khcn_View_Helper_GetBaseUrl::getBaseUrl();
     $file = new Zend_Form_Element_File('file');
     $file->setLabel('Upload file')->setRequired(true)->setDescription('(*.xlsx, *.xls)<br/> Click <a href="' . $baseUrl . '/../application/templates/admin/files/bai_bao_khoa_hoc_import.xlsx">here</a> to download sample file.')->setDestination(BASE_PATH . '/upload/files/temp/')->addValidator(new Zend_Validate_File_Extension(array('xls', 'xlsx')))->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'))))->setAttribs(array('id' => 'file'));
     $file->getDecorator('Description')->setOption('escape', false);
     $submit = new Zend_Form_Element_Submit('submit');
     $submit->setLabel('Lưu vào csdl')->setDecorators(array('ViewHelper', array(array('data' => 'HtmlTag'), array('tag' => 'span')), array(array('row' => 'HtmlTag'), array('tag' => 'span', 'class' => 'filter_btn_l'))))->setAttribs(array('class' => 'button'));
     $this->addElements(array($file, $submit));
     $this->addDisplayGroup(array('submit'), 'import', array('decorators' => array('FormElements', array(array('data' => 'HtmlTag'), array('tag' => 'td')), array(array('row' => 'HtmlTag'), array('tag' => 'td')), array('HtmlTag', array('tag' => 'tr', 'id' => 'import')))));
     $this->setDecorators(array('FormElements', array('HtmlTag', array('tag' => 'table', 'class' => 'import_dt')), 'Form'));
 }
Example #7
0
 public function init()
 {
     $this->setName('adv_form_search')->setMethod('get')->setAction(Khcn_View_Helper_GetBaseUrl::getBaseUrl() . '/index/search');
     $this->addElement('Text', 'keyword', array('label' => 'Từ khóa : ', 'allowEmpty' => true, 'filters' => array('StripTags')));
     $this->addElement('Radio', 'search_full', array('multiOptions' => array(0 => 'Tất cả các từ', 1 => 'Tìm chính xác cụm từ')));
     $this->search_full->removeDecorator('Label');
     $typesOptions = Khcn_Api::_()->getDbTable('searchtypes', 'default')->getSearchTypesEnabledAssoc();
     if (count($typesOptions) > 0) {
         $this->addElement('MultiCheckbox', 'types', array('label' => 'Tìm kiếm theo : ', 'multiOptions' => $typesOptions));
     }
     // Element: submit
     $this->addElement('Button', 'submit', array('label' => 'Tìm kiếm', 'type' => 'submit'));
 }
Example #8
0
 public function init()
 {
     $this->setName('f2')->setMethod('post')->setAttribs(array('id' => 'user'));
     $username = new Zend_Form_Element_Text('ten_dang_nhap');
     $username->setLabel('Tên đăng nhập (*)')->setOptions(array('size' => '36'))->setRequired(true)->addFilter('StripTags')->addFilter('StringTrim')->addFilter('StringToLower')->addValidator('NotEmpty')->addValidator(new Zend_Validate_StringLength(0, 32))->setDecorators(array('ViewHelper', 'Errors', 'Label', array(array('row' => 'HtmlTag'), array('tag' => 'div'))))->setAttribs(array('id' => 'ten_dang_nhap'));
     $captcha = $this->createElement('captcha', 'captcha', array('required' => true, 'captcha' => array('captcha' => 'Image', 'font' => APPLICATION_PATH . '/templates/default/fonts/arialn.ttf', 'fontSize' => '24', 'wordLen' => 6, 'height' => '50', 'width' => '150', 'imgDir' => APPLICATION_PATH . '/../public/captcha', 'imgUrl' => Khcn_View_Helper_GetBaseUrl::getBaseUrl() . '/captcha', 'dotNoiseLevel' => 50, 'lineNoiseLevel' => 5, 'decorators' => array('ViewHelper', 'Errors', 'Label', array(array('data' => 'HtmlTag'), array('tag' => 'span')), array(array('row' => 'HtmlTag'), array('tag' => 'div'))))));
     $captcha->setLabel('Nhập mã bảo vệ (*)');
     $submit = new Zend_Form_Element_Submit('submit');
     $submit->setDecorators(array('ViewHelper', array(array('data' => 'HtmlTag'), array('tag' => 'span')), array(array('row' => 'HtmlTag'), array('tag' => 'span'))))->setAttribs(array('class' => 'art-button'));
     $this->addElements(array($username, $captcha, $submit));
     $this->addDisplayGroup(array('ten_dang_nhap', 'captcha'), 'reset_pass', array('Legend' => 'Thông tin tài khoản', 'decorators' => array('FormElements', array('fieldset', array('class' => 'contact')), array(array('row' => 'HtmlTag'), array('tag' => 'div')))));
     $this->addDisplayGroup(array('submit'), 'submitbtn', array('decorators' => array('FormElements', array(array('row' => 'HtmlTag'), array('tag' => 'div', 'align' => 'center')))));
     $this->setDecorators(array('FormElements', array('HtmlTag', array('tag' => 'div')), 'Form'));
 }
Example #9
0
 public function dsBieuMau()
 {
     $results = Khcn_Api::_()->getDbTable('loai_bieu_mau', 'default')->getAll();
     $str = '<div id="ds_bieu_mau">';
     foreach ($results as $loai_bm) {
         $bieuMaus = $loai_bm->getDanhSachBieuMau();
         $str .= "<h3>" . $loai_bm->getTitle() . "</h3>";
         $str .= "<div><ul>";
         foreach ($bieuMaus as $bieu_mau) {
             $str .= '<li><a class="Normal" href="' . Khcn_View_Helper_GetBaseUrl::getBaseUrl() . '/upload/files/bieu_mau/' . $bieu_mau->ten_file . '">' . $bieu_mau->getTitle() . '</a></li>';
         }
         $str .= "</ul></div>";
     }
     $str .= '</div>';
     return $str;
 }
Example #10
0
 public function init()
 {
     $this->setName('f2')->setMethod('post')->setAttrib('class', 'global_form form_user_signup');
     $id = new Khcn_Form_Element_Hidden('id');
     $id->addFilter('Int')->removeDecorator('label');
     $this->addElement('Heading', 'account', array('value' => 'Thông tin tài khoản'));
     $this->account->removeDecorator('Label')->removeDecorator('HtmlTag')->getDecorator('HtmlTag2')->setOption('class', 'form-wrapper-heading');
     $username = new Khcn_Form_Element_Text('ten_dang_nhap');
     $username->setLabel('Tên đăng nhập (*)')->setRequired(true)->addFilter('StripTags')->addFilter('StringTrim')->addFilter('StringToLower')->addValidator('NotEmpty')->addValidator('Alnum')->addValidator(new Zend_Validate_StringLength(0, 32))->setAttribs(array('id' => 'ten_dang_nhap'));
     $this->addElement($username);
     $this->ten_dang_nhap->addValidator('Db_NoRecordExists', true, array('nguoi_dung', 'ten_dang_nhap'));
     $this->ten_dang_nhap->getValidator('Db_NoRecordExists')->setMessage('Tên đăng nhập đã được sử dụng.', 'recordFound');
     $password = new Khcn_Form_Element_Password('mat_khau');
     $password->setLabel('Mật khẩu (*)')->setRequired(true)->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty')->setAttribs(array('id' => 'mat_khau'));
     $this->addElement($password);
     $repassword = new Khcn_Form_Element_Password('mat_khau_2');
     $repassword->setLabel('Nhập lại mật khẩu (*)')->setRequired(true)->addFilter('StripTags')->addFilter('StringTrim')->addValidator(new Zend_Validate_Identical('mat_khau'))->setAttribs(array('id' => 'mat_khau_2'));
     $this->addElement($repassword);
     $this->addElement('Heading', 'contact', array('value' => 'Thông tin người dùng'));
     $this->contact->removeDecorator('Label')->removeDecorator('HtmlTag')->getDecorator('HtmlTag2')->setOption('class', 'form-wrapper-heading');
     $ho = new Khcn_Form_Element_Text('ho');
     $ho->setLabel('Họ (*)')->setOptions(array('size' => '36'))->setRequired(true)->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty')->addValidator(new Zend_Validate_StringLength(0, 128))->setAttribs(array('id' => 'ho'));
     $this->addElement($ho);
     $ten = new Khcn_Form_Element_Text('ten');
     $ten->setLabel('Tên (*)')->setOptions(array('size' => '36'))->setRequired(true)->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty')->addValidator(new Zend_Validate_StringLength(0, 32))->setAttribs(array('id' => 'ten'));
     $this->addElement($ten);
     $ngay_sinh = new Khcn_Form_Element_Text('ngay_sinh');
     $ngay_sinh->setLabel('Ngày sinh')->setAttribs(array('id' => 'ngay_sinh'));
     $this->addElement($ngay_sinh);
     $email = new Khcn_Form_Element_Text('email');
     $email->setLabel('Email (*)')->setRequired(true)->setOptions(array('size' => '36'))->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty')->addValidator(new Zend_Validate_EmailAddress())->setAttribs(array('id' => 'email'));
     $this->addElement($email);
     $this->email->addValidator('Db_NoRecordExists', true, array('nguoi_dung', 'email'));
     $this->email->getValidator('Db_NoRecordExists')->setMessage('Email đã được sử dụng.', 'recordFound');
     $captcha = $this->createElement('captcha', 'captcha', array('required' => true, 'captcha' => array('captcha' => 'Image', 'font' => APPLICATION_PATH . '/templates/default/fonts/arialn.ttf', 'fontSize' => '24', 'wordLen' => 6, 'height' => '50', 'width' => '150', 'imgDir' => APPLICATION_PATH . '/../public/captcha', 'imgUrl' => Khcn_View_Helper_GetBaseUrl::getBaseUrl() . '/captcha', 'dotNoiseLevel' => 50, 'lineNoiseLevel' => 5)));
     $captcha->setLabel('Nhập mã bảo vệ (*)');
     $this->addElement($captcha);
     $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');
 }
Example #11
0
 public function getHref($params = array())
 {
     return Khcn_View_Helper_GetBaseUrl::getBaseUrl() . '/upload/files/ho_so/' . $this->ten_file;
 }
Example #12
0
 public function suaAction()
 {
     $form = new Admin_Form_ThongBao();
     $form->removeElement('submitCon');
     $form->submitExit->setLabel('Lưu');
     $form->cancel->setLabel('Không lưu');
     $this->view->form = $form;
     $id = $this->_getParam('id');
     $thong_bao = Khcn_Api::_()->getItem('default_thong_bao', $id);
     if (!$thong_bao) {
         $_SESSION['msg'] = 'Lỗi !. Thông báo không tồn tại .';
         $_SESSION['type_msg'] = 'error';
         return $this->_redirect('/admin/thong-bao/index');
     }
     $form->image->setImage(Khcn_View_Helper_GetBaseUrl::getBaseUrl() . '/upload/files/thong_bao/' . $thong_bao['file']);
     $form->populate($thong_bao->toArray());
     if (!$this->getRequest()->isPost()) {
         return;
     }
     if (!$form->isValid($this->getRequest()->getPost())) {
         return;
     }
     if ($form->photo->getFileName(null, false) != null) {
         //determine filename and extension
         $info = pathinfo($form->photo->getFileName(null, false));
         $filename = $info['filename'];
         $ext = $info['extension'] ? "." . $info['extension'] : "";
         //filter for renaming.. prepend with current time
         $file = time() . '_' . Default_Model_Functions::convert_vi_to_en($filename) . $ext;
         $form->photo->addFilter(new Zend_Filter_File_Rename(array("target" => $file, "overwrite" => true)))->addFilter(new Khcn_Filter_File_Resize(array('width' => 720, 'height' => 720, 'keepRatio' => true)));
         $form->getValue('photo');
         // Remove old file
         $oldFile = $thong_bao->file;
         if ($oldFile != '' && file_exists(APPLICATION_PATH . '/../public/upload/files/thong_bao/' . $oldFile)) {
             unlink(APPLICATION_PATH . '/../public/upload/files/thong_bao/' . $oldFile);
         }
         $thong_bao->file = $file;
     }
     if ($form->pdf->getFileName(null, false) != null) {
         //determine filename and extension
         $info = pathinfo($form->pdf->getFileName(null, false));
         $filename = $info['filename'];
         $ext = $info['extension'] ? "." . $info['extension'] : "";
         //filter for renaming.. prepend with current time
         $file = time() . '_' . Default_Model_Functions::convert_vi_to_en($filename) . $ext;
         $form->pdf->addFilter(new Zend_Filter_File_Rename(array("target" => $file, "overwrite" => true)));
         $form->getValue('pdf');
         // Remove old file
         $oldFile = $thong_bao->file_pdf;
         if ($oldFile != '' && file_exists(APPLICATION_PATH . '/../public/upload/files/thong_bao/' . $oldFile)) {
             unlink(APPLICATION_PATH . '/../public/upload/files/thong_bao/' . $oldFile);
         }
         $thong_bao->file_pdf = $file;
     }
     $values = $form->getValues();
     $thong_bao->setFromArray($values);
     $thong_bao->save();
     $_SESSION['msg'] = 'Thành công !. Dữ liệu đã được cập nhật .';
     $_SESSION['type_msg'] = 'success';
     $this->_redirect('/admin/thong-bao/index');
 }
Example #13
0
 public function suaAction()
 {
     $form = new Admin_Form_HoiThao();
     $form->removeElement('submitCon');
     $this->view->form = $form;
     $id = $this->_getParam('id');
     $hoi_thao = Khcn_Api::_()->getItem('default_hoi_thao', $id);
     $form->populate($hoi_thao->toArray());
     if ($hoi_thao['anh_trang_bia'] != '') {
         $form->image->setImage(Khcn_View_Helper_GetBaseUrl::getBaseUrl() . '/upload/images/hoi_thao/' . $hoi_thao['anh_trang_bia']);
     } else {
         $form->removeElement('image');
     }
     if (!$this->getRequest()->isPost()) {
         return;
     }
     if (!$form->isValid($this->getRequest()->getPost())) {
         return;
     }
     $table = Khcn_Api::_()->getDbTable('hoi_thao', 'default');
     $db = $table->getAdapter();
     $db->beginTransaction();
     try {
         if ($form->file_anh_trang_bia->getFileName(null, false) != null) {
             //determine filename and extension
             $info = pathinfo($form->file_anh_trang_bia->getFileName(null, false));
             $filename = $info['filename'];
             $ext = $info['extension'] ? "." . $info['extension'] : "";
             //filter for renaming.. prepend with current time
             $anh_trang_bia = time() . '_' . Default_Model_Functions::convert_vi_to_en($filename) . $ext;
             $form->file_anh_trang_bia->addFilter(new Zend_Filter_File_Rename(array("target" => $anh_trang_bia, "overwrite" => true)))->addFilter(new Khcn_Filter_File_Resize(array('width' => 720, 'height' => 720, 'keepRatio' => true)));
             $form->getValue('file_anh_trang_bia');
             $hoi_thao->anh_trang_bia = $anh_trang_bia;
         }
         if ($form->file_thong_cao_bao_chi->getFileName(null, false) != null) {
             //determine filename and extension
             $info = pathinfo($form->file_thong_cao_bao_chi->getFileName(null, false));
             $filename = $info['filename'];
             $ext = $info['extension'] ? "." . $info['extension'] : "";
             //filter for renaming.. prepend with current time
             $thong_cao_bao_chi = time() . '_' . Default_Model_Functions::convert_vi_to_en($filename) . $ext;
             $form->file_thong_cao_bao_chi->addFilter(new Zend_Filter_File_Rename(array("target" => $thong_cao_bao_chi, "overwrite" => true)));
             $form->getValue('file_thong_cao_bao_chi');
             $hoi_thao->thong_cao_bao_chi = $thong_cao_bao_chi;
         }
         $values = $form->getValues();
         if (!empty($values['ngay_to_chuc'])) {
             $values['ngay_to_chuc'] = date('Y-m-d', strtotime($values['ngay_to_chuc']));
         }
         $hoi_thao->setFromArray($values);
         $hoi_thao->save();
         $db->commit();
         $_SESSION['msg'] = 'Thành công !. Dữ liệu đã được cập nhật .';
         $_SESSION['type_msg'] = 'success';
         $this->_redirect('/admin/hoi-thao/index');
     } catch (Exception $e) {
         $db->rollBack();
         throw $e;
     }
 }