Example #1
0
 /** Load the form options based on the broadperiod provided
  * @access public
  * @param string $broadperiod
  * @return \GreekAndRomanCoinForm
  * @throws Exception
  */
 public function loadForm($broadperiod)
 {
     switch ($broadperiod) {
         case 'ROMAN':
             $form = new RomanCoinForm();
             $form->details->setLegend('Add Roman numismatic data');
             $form->submit->setLabel('Add Roman data');
             $this->_view->headTitle('Add a Roman coin\'s details');
             $this->_view->jQuery()->addJavascriptFile($this->_view->baseUrl() . '/js/JQuery/coinslinkedinit.js', $type = 'text/javascript');
             break;
         case 'IRON AGE':
             $form = new IronAgeCoinForm();
             $form->details->setLegend('Add Iron Age numismatic data');
             $form->submit->setLabel('Add Iron Age data');
             $this->_view->headTitle('Add an Iron Age coin\'s details');
             $this->_view->jQuery()->addJavascriptFile($this->_view->baseUrl() . '/js/JQuery/iacoinslinkedinit.js', $type = 'text/javascript');
             break;
         case 'EARLY MEDIEVAL':
             $form = new EarlyMedievalCoinForm();
             $form->details->setLegend('Add Early Medieval numismatic data');
             $form->submit->setLabel('Add Early Medieval data');
             $this->_view->headTitle('Add an Early Medieval coin\'s details');
             $this->_view->jQuery()->addJavascriptFile($this->_view->baseUrl() . '/js/JQuery/coinslinkedinitearlymededit.js', $type = 'text/javascript');
             break;
         case 'MEDIEVAL':
             $form = new MedievalCoinForm();
             $form->details->setLegend('Add Medieval numismatic data');
             $form->submit->setLabel('Add Medieval data');
             $this->_view->headTitle('Add a Medieval coin\'s details');
             $this->_view->jQuery()->addJavascriptFile($this->_view->baseUrl() . '/js/JQuery/coinslinkedinitmededit.js', $type = 'text/javascript');
             break;
         case 'POST MEDIEVAL':
             $form = new PostMedievalCoinForm();
             $form->details->setLegend('Add Post Medieval numismatic data');
             $form->submit->setLabel('Add Post Medieval data');
             $this->_view->headTitle('Add a Post Medieval coin\'s details');
             $this->_view->jQuery()->addJavascriptFile($this->_view->baseUrl() . '/js/JQuery/coinslinkedinitpostmededit.js', $type = 'text/javascript');
             break;
         case 'BYZANTINE':
             $form = new ByzantineCoinForm();
             $form->details->setLegend('Add Byzantine numismatic data');
             $form->submit->setLabel('Add Byzantine data');
             break;
         case 'GREEK AND ROMAN PROVINCIAL':
             $form = new GreekAndRomanCoinForm();
             $form->details->setLegend('Add Greek & Roman numismatic data');
             $form->submit->setLabel('Add Greek & Roman data');
             break;
         default:
             throw new Exception('You cannot have a coin for that period.');
     }
     return $form;
 }
 function indexAction()
 {
     //Zend_Session::namespaceUnset('cart');
     $yourCart = new Zend_Session_Namespace('cart');
     //$yourCart->count= ham_1($yourCart->count);
     $ssInfo = $yourCart->getIterator();
     $filter = new Zend_Filter_Digits();
     $id = $filter->filter($this->_arrParam['id']);
     if (count($yourCart->cart) == 0) {
         $cart[$id] = 1;
         $yourCart->cart = $cart;
     } else {
         //echo '<br>Trong gio hang da co san pham';
         $tmp = $ssInfo['cart'];
         if (array_key_exists($id, $tmp) == true) {
             $tmp[$id] = $tmp[$id] + 1;
         } else {
             $tmp[$id] = 1;
         }
         $yourCart->cart = $tmp;
     }
     $base = new Zend_View();
     $link = $base->baseUrl();
     $url = $link . "/shoppingcart";
     chuyen_trang($url);
 }
Example #3
0
 /**
  * postDispatch
  *
  * @param  Zend_Controller_Request_Abstract $oRequest
  * @return void
  */
 public function postDispatch(Zend_Controller_Request_Abstract $oRequest)
 {
     // Vars
     $module = $oRequest->getModuleName();
     $controller = $oRequest->getControllerName();
     $action = $oRequest->getActionName();
     // Auto include action css/js
     // @todo Include css/js from alternative directories if public folder for the theme
     //       is founded in other folder
     $jsFind = false;
     $publicPath = ROOT_PATH . $this->_frontOptions['publicDir'];
     foreach ($this->_themes as $theme) {
         $themePath = '/themes/' . $theme;
         if ($module == "default") {
             $cssUri = $themePath . "/controllers/{$controller}/{$action}.css";
             $jsUri = $themePath . "/controllers/{$controller}/{$action}.js";
         } else {
             $cssUri = $themePath . "/modules/{$module}/{$controller}/{$action}.css";
             $jsUri = $themePath . "/modules/{$module}/{$controller}/{$action}.js";
         }
         if (is_file($publicPath . "/" . $cssUri)) {
             $this->_view->headLink()->appendStylesheet($this->_view->baseUrl($cssUri));
         }
         if (is_file($publicPath . "/" . $jsUri) and !$jsFind) {
             $this->_view->headScript()->appendFile($this->_view->baseUrl($jsUri));
             $jsFind = true;
         }
     }
 }
Example #4
0
 /**
  * dispatchLoopStartup
  *
  * @param  Zend_Controller_Request_Abstract $oRequest
  * @return void
  */
 public function dispatchLoopStartup(Zend_Controller_Request_Abstract $oRequest)
 {
     // Hack DOJO
     Zend_Dojo_View_Helper_Dojo::setUseDeclarative();
     $contextSwitch = Zend_Controller_Action_HelperBroker::getStaticHelper('ContextSwitch');
     $contextParam = $contextSwitch->getContextParam();
     $format = $oRequest->getParam($contextParam);
     // Inject javascript vars
     if (!$format or $format == "html" or $format == "html-json" or $format == "html-xml") {
         $this->_view->dojo()->setDjConfigOption('ZlBaseUrl', $this->_view->baseUrl());
         $this->_view->dojo()->setDjConfigOption('ZlBaseThemeUrl', $this->_view->baseThemeUrl());
         $this->_view->dojo()->setDjConfigOption('ZlModule', $oRequest->getModuleName());
         $this->_view->dojo()->setDjConfigOption('ZlController', $oRequest->getControllerName());
         $this->_view->dojo()->setDjConfigOption('ZlAction', $oRequest->getActionName());
     }
 }
Example #5
0
 public function Search()
 {
     $view = new Zend_View();
     $base = $view->baseUrl();
     // echo"<script type=\"text/javascript\" src=\"$base/js/AJAX_2.js\"></script>";
     echo "<link href=\"{$base}/css/bootstrap-cerulean_1.css\" media=\"screen\" rel=\"stylesheet\" type=\"text/css\" >\n";
     echo "<form action=\"{$base}/product/search\" method=\"get\" enctype=\"multipart/form-data\" name=\"tt_mh\" id=\"tt_mh\"  class=\"form-horizontal\">\n <div class=\"control-group\" style='margin-left:-30px'>\n        <label class=\"control-label\" for=\"selectError\">Tìm kiếm</label>\n        <div class=\"controls\">\n            <input name=\"title\" type=\"text\" class=\"span6 typeahead\" id=\"typeahead\"  data-provide=\"typeahead\"  style=\"float: left; margin-right: 10px; width: 250px\" >\n            \n           ";
     $page = new Default_Model_Page();
     $page->list_category();
     echo "   <script>\n            \$(document).ready(function(  ){\n                \$(\"select option:selected\").each(function () {\n                    \$(\"div#div123\").get(\"{$base}/default/register/menu?id=\" + \$(this).val());\n                });\t\n            });\n\t\n            \$(\"select#category_id\").change(function () {\n                var str = \"\";\n                \$(\"select option:selected\").each(function () {\n                    str += \$(this).val() + \" \";\n                });\n               \n            })\n            .change(function(  ){\n                \$(\"div#div123\").load(\"{$base}/default/register/menu?id=\" + \$(this).val());\n            });\n        </script> ";
     echo "\n        <div id=\"div123\" style=\"float: left; margin: 2px 10px 0px 0px\">\n                <select name=\"\">\n                    <option>--- Chọn menu ---</option>\n                </select>\n            </div>\n            <div id=\"div2\" style=\"float: left;margin: 2px 10px 0px 0px\"></div>\n            <button type=\"submit\" class=\"btn btn-primary\" style=\"margin-top: 2px\">Search</button>\n        </div>\n    </div>\n            \n\n   \n                 \n               \n   \n</form>\n     \n";
 }
Example #6
0
 /** Construct the form
  * @access public
  */
 public function __construct()
 {
     $this->addPrefixPath('Pas_Form_Element', 'Pas/Form/Element', 'element');
     $this->addElementPrefixPath('Pas_Filter', 'Pas/Filter/', 'filter');
     $this->addElementPrefixPath('Pas_Validate', 'Pas/Validate/', 'validate');
     $this->setAttrib('class', 'form-horizontal');
     $this->setAttrib('accept-charset', 'UTF-8');
     $this->clearDecorators();
     $this->_view = Zend_Layout::getMvcInstance()->getView();
     $this->_view->jQuery()->addJavascriptFile($this->_view->baseUrl() . '/js/select2.min.js', $type = 'text/javascript');
     $this->_view->jQuery()->addJavascriptFile($this->_view->baseUrl() . '/js/selectPrettify.js', $type = 'text/javascript');
     $this->_view->headLink()->appendStylesheet($this->_view->baseUrl() . '/css/select2.css', $type = 'screen');
     $this->_view->headLink()->appendStylesheet($this->_view->baseUrl() . '/css/bootstrap-multiselect.css', $type = 'screen');
     $person = new Pas_User_Details();
     $details = $person->getPerson();
     if ($details) {
         $this->_role = $details->role;
     } else {
         $this->_role = 'public';
     }
     parent::__construct();
 }
 /**
  * Returns a list of available icons under 'htdocs/pulse/icons'
  * @return string[]
  */
 protected function _getAvailableIcons()
 {
     $icons = array();
     $iterator = new DirectoryIterator(realpath(GEMS_WEB_DIR . '/gems/icons'));
     foreach ($iterator as $fileinfo) {
         if ($fileinfo->isFile()) {
             // $icons[$fileinfo->getFilename()] = $fileinfo->getFilename();
             $filename = $fileinfo->getFilename();
             $url = $this->view->baseUrl() . \MUtil_Html_ImgElement::getImageDir($filename);
             $icons[$fileinfo->getFilename()] = \MUtil_Html::create('span', $filename, array('style' => 'background: transparent url(' . $url . $filename . ') center right no-repeat; padding-right: 20px;'));
         }
     }
     return $icons;
 }
Example #8
0
 /**
  * Metodo que adicona os arquivos CSS/JS básicos para a requisição.
  *
  * @param Zend_View $view        	
  */
 public function addBasicFilesOfRequestToView(&$view, $inibeCache = false)
 {
     // Paths básicos para os arquivos de JS e CSS
     $pathStylesheet = SITE_PATH . '/css';
     $pathScript = SITE_PATH . '/js';
     // Incrementa cada path com a expressao
     // <path>/<module>/<controller>/<action>.(css,js)
     $pathStylesheet .= '/' . $this->getRequest()->getModuleName() . '/' . $this->getRequest()->getControllerName() . '/' . $this->getRequest()->getActionName() . '.css';
     $pathScript .= '/' . $this->getRequest()->getModuleName() . '/' . $this->getRequest()->getControllerName() . '/' . $this->getRequest()->getActionName() . '.js';
     // Verifica se o path indicado é realmente um arquivo de estilos válido
     if (is_file($pathStylesheet) && is_readable($pathStylesheet)) {
         // Recupera o caminho relativo do arquivo
         $relativeStylesheet = str_replace(SITE_PATH, $view->baseUrl(), $pathStylesheet);
         // Adiciona o arquivo a lista de styles do site
         $view->headLink()->appendStylesheet($relativeStylesheet . ($inibeCache ? '?' . mt_rand(0, 99999) : ''));
     }
     // Verifica se o path indicado é realmente um arquivo de scripts válido
     if (is_file($pathScript) && is_readable($pathScript)) {
         // Recupera o caminho relativo do arquivo
         $relativeScript = str_replace(SITE_PATH, $view->baseUrl(), $pathScript);
         // Adiciona o arquivo a lista de styles do site
         $view->headScript()->appendFile($relativeScript . ($inibeCache ? '?' . mt_rand(0, 99999) : ''));
     }
 }
Example #9
0
 public function cart_order($arrParam)
 {
     $view = new Zend_View();
     $base = $view->baseUrl();
     //			echo '<pre>';
     //			print_r($arrParam['cart']['71']);
     //			echo '</pre>';
     //var_dump(count($arrParam['cart']));
     if (count($arrParam) > 0) {
         $i = 1;
         foreach ($arrParam as $k => $v) {
             if ($k) {
                 $i = 2;
             }
         }
         if ($i == 2) {
             $sl = 0;
             foreach ($arrParam as $key => $val) {
                 $item[] = $key;
                 $demo[] = $val;
             }
             $ids = implode(",", $item);
             for ($i = 0; $i < count($arrParam); $i++) {
                 $id = $item[$i];
                 $sl = $demo[$i];
             }
             $ids = implode(",", $item);
             echo "\n <div style=\"margin-bottom:3px\"><font> Tổng số: <span class=\"so_luong\" > {$sl}</span> sản phẩm</font></div>\n\t\t\t\n\t\t\t<a href=\"{$base}/shoppingcart\" ><img style=\"margin-bottom:5px;\"  src=\"{$base}/template/images/sua-gio-hang.jpg\" align=\"texttop\" /></a>\n\n\n";
             $query = "SELECT * FROM products where id in ({$ids}) order by position ASC, id DESC";
             $stml = $this->db->fetchAll($query);
             return $stml;
         } else {
         }
     } else {
     }
 }
Example #10
0
 public function preDispatch(Zend_Controller_Request_Abstract $request)
 {
     $this->controller = $request->getControllerName();
     $this->action = $request->getActionName();
     $this->module = $request->getModuleName();
     /* Adiciono os js padrão */
     $view = new Zend_View();
     $cfg = Zend_Registry::get('config');
     $module = $request->getModuleName();
     $controller = $request->getControllerName();
     $action = $request->getActionName();
     $layout = Zend_Layout::getMvcInstance()->getLayout();
     //        $jss = array(
     //            'config'
     //        );
     //
     //
     //
     //        foreach ($jss as $js)
     //            $view->headScript()->appendFile($view->baseUrl($js), 'text/javascript');
     /*         * ******************************JS e CSS Adicionais***************************** */
     $jss_adicionais = $cfg->{$module} ? $cfg->{$module}->headScript ? $cfg->{$module}->headScript->toArray() : false : false;
     $css_adicionais = $cfg->{$module} ? $cfg->{$module}->headLink ? $cfg->{$module}->headLink->toArray() : false : false;
     $jss_adicionaisAmbos = $cfg->ambos->headScript ? $cfg->ambos->headScript->toArray() : false;
     $css_adicionaisAmbos = $cfg->ambos->headLink ? $cfg->ambos->headLink->toArray() : false;
     $adicionais = array();
     if ($jss_adicionais) {
         $adicionais = array_merge($adicionais, $jss_adicionais);
     }
     if ($css_adicionais) {
         $adicionais = array_merge($adicionais, $css_adicionais);
     }
     if ($jss_adicionaisAmbos) {
         $adicionais = array_merge($adicionais, $jss_adicionaisAmbos);
     }
     if ($css_adicionaisAmbos) {
         $adicionais = array_merge($adicionais, $css_adicionaisAmbos);
     }
     //Adicionando essenciais na página Auth
     if ($controller == 'auth') {
         $jquery = 'public/js/jquery.min.js';
         $view->headScript()->appendFile($view->baseUrl($jquery), 'text/javascript');
         $jsmaruti = 'public/js/maruti.login.js';
         $view->headScript()->appendFile($view->baseUrl($jsmaruti), 'text/javascript');
         $bootstrapcss = 'public/css/bootstrap.min.css';
         $view->headLink()->appendStylesheet($view->baseUrl($bootstrapcss));
         $bootstrapresponsive = 'public/css/bootstrap-responsive.min.css';
         $view->headLink()->appendStylesheet($view->baseUrl($bootstrapresponsive));
         $maruti = 'public/css/maruti-login.css';
         $view->headLink()->appendStylesheet($view->baseUrl($maruti));
     }
     //Acrescento o basedir nas urls e adiciono na página
     if (count($adicionais) && $controller != 'auth') {
         foreach ($adicionais as $adicional) {
             $fileAdicional = 'public' . $adicional;
             $ext = array_pop(explode('.', $fileAdicional));
             if ($ext == 'js') {
                 $view->headScript()->appendFile($view->baseUrl($fileAdicional), 'text/javascript');
             } else {
                 $view->headLink()->appendStylesheet($view->baseUrl($fileAdicional));
             }
         }
     }
     //                $view->headLink(array('rel' => 'shortcut icon',
     //
     //                                  'href' => $view->baseUrl('/data/favicon.ico')));
     /*         * ************************************************************************* */
     if ($controller != 'impressos') {
         My_Layout_Assist::out();
     }
     $viewLayout = Zend_Layout::getMvcInstance()->getView();
     $viewLayout->controller = $controller;
     $viewLayout->action = $action;
     ######################################################################
     $mod = $request->getModuleName();
     $controller = $this->controller = $request->getControllerName();
     $action = $request->getActionName();
     Zend_Layout::getMvcInstance()->setLayoutPath(APPLICATION_PATH . DS . 'modules' . DS . $mod . DS . 'views' . DS . 'layouts');
     $view = new Zend_View();
     $auth = Zend_Auth::getInstance();
     //        if ($auth->hasIdentity()) {
     //
     //            $table = new User();
     //
     //            $user = $auth->getIdentity();
     //
     //            $viewLayout->user = $table->fetchRow(array('id = ?' => $user->id));
     //        }
 }
Example #11
0
 public function page_sildeshow()
 {
     $view = new Zend_View();
     $base = $view->baseUrl();
     echo "\n   <link rel=\"stylesheet\" href=\"{$base}/template/js_side/nivo-slider.css\" type=\"text/css\" media=\"all\" />\n       <link rel=\"stylesheet\" href=\"{$base}/template/js_side/style_1.css\" type=\"text/css\" media=\"all\" />     \n";
     echo "\n        <div id=\"slider\" class=\"nivoSlider\">";
     $query = "SELECT * FROM side  order by position ASC limit 0,10 ";
     $stml = $this->db->prepare($query);
     $stml->execute();
     while ($result = $stml->fetch(PDO::FETCH_ASSOC)) {
         $id = $result['id'];
         $images = $result['images'];
         $title = $result['title'];
         $description = nl2br($result['description']);
         $link = $result['link'];
         // cache
         echo " \n             \n                \n                    <img src=\"{$base}/Upload/{$images}\"  alt=\"{$title}\" title=\"{$title}\" data-transition=\"fade\" />\n                    \n                \n\n                ";
         //Zend_Registry::get('Cache')->remove('main_menu');
     }
     echo "</div> ";
     echo " <script type=\"text/javascript\" src=\"{$base}/template/js_side/jquery-1.4.3.min.js\"></script>";
     echo " <script type=\"text/javascript\" src=\"{$base}/template/js_side/jquery.nivo.slider.pack.js\"></script>";
     echo "<script type=\"text/javascript\">\n                    \$(window).load(function() {\n                    \$('#slider').nivoSlider();\n                    });\n                </script>";
 }
Example #12
0
 function afterSave()
 {
     $session = SessionWrapper::getInstance();
     # add log to audit trail
     $view = new Zend_View();
     $url = $view->serverUrl($view->baseUrl('role/view/id/' . encode($this->getID())));
     $usecase = '0.4';
     $module = '0';
     $type = SYSTEM_CREATEROLE;
     $details = "Role <a href='" . $url . "' class='blockanchor'>" . $this->getName() . "</a> created";
     $browser = new Browser();
     $audit_values = $session->getVar('browseraudit');
     $audit_values['module'] = $module;
     $audit_values['usecase'] = $usecase;
     $audit_values['transactiontype'] = $type;
     $audit_values['status'] = "Y";
     $audit_values['userid'] = $session->getVar('userid');
     $audit_values['transactiondetails'] = $details;
     $audit_values['url'] = $url;
     // debugMessage($audit_values);
     $this->notify(new sfEvent($this, $type, $audit_values));
 }
 function contactAction()
 {
     $muser = new Default_Model_System();
     $conten = $muser->list_system();
     $this->view->book = $conten;
     $captcha = new Zend_Captcha_Image();
     $vi = new Zend_View();
     $base = $vi->baseUrl();
     if (!$this->_request->isPost()) {
         $captcha->setTimeout('300')->setWordLen('4')->setHeight('50')->setWidth('200')->setImgDir(APPLICATION_PATH . '/../captcha/images/')->setImgUrl($base . '/captcha/images/')->setFont(APPLICATION_PATH . '/../font/UTM-Avo.ttf');
         $captcha->generate();
         $this->view->captcha = $captcha->render($this->view);
         $this->view->captchaID = $captcha->getId();
         // Dua chuoi Captcha vao session
         $captchaSession = new Zend_Session_Namespace('Zend_Form_Captcha_' . $captcha->getId());
         $captchaSession->word = $captcha->getWord();
     } else {
         $captchaID = $this->_request->captcha_id;
         $captchaSession = new Zend_Session_Namespace('Zend_Form_Captcha_' . $captchaID);
         $captchaIterator = $captchaSession->getIterator();
         $captchaWord = $captchaIterator['word'];
         if ($this->_request->captcha == $captchaWord) {
             $this->view->purifier = Zend_Registry::get('purifier');
             $conf = HTMLPurifier_Config::createDefault();
             $purifier = new HTMLPurifier($conf);
             $fullname = $purifier->purify($this->_request->getParam('fullname'));
             $address = $purifier->purify($this->_request->getParam('address'));
             $phone = $purifier->purify($this->_request->getParam('phone'));
             $email = $purifier->purify($this->_request->getParam('email'));
             $content = $purifier->purify($this->_request->getParam('content'));
             $title = $purifier->purify($this->_request->getParam('title'));
             $emaillh = $conten[0]['email'];
             $tinnhan = "\n\t\t\tHọ tên : {$fullname} <br>\n\t\t\tEmail : {$email}<br>\n\t\t\tĐịa chỉ : {$address}<br>\n\t\t\tĐiện thoại : {$phone}<br>\n\t\t\t\n\t\t\tNội dung : {$content}<br>";
             require 'ham/class.phpmailer.php';
             require 'ham/class.pop3.php';
             // nạp thư viện
             $mail = new PHPMailer();
             // khởi tạo đối tượng
             $mail->IsSMTP();
             // gọi class smtp để đăng nhập
             $mail->CharSet = "utf-8";
             // bảng mã unicode
             //Đăng nhập Gmail
             $mail->SMTPAuth = true;
             // Đăng nhập
             $mail->SMTPSecure = "ssl";
             // Giao thức SSL
             $mail->Host = "smtp.gmail.com";
             // SMTP của GMAIL
             $mail->Port = 465;
             // cổng SMTP
             // Phải chỉnh sửa lại
             $mail->Username = "******";
             // GMAIL username
             $mail->Password = "******";
             // GMAIL password
             $mail->Subject = 'Thông tin liên hệ';
             $mail->AddAddress("{$emaillh}");
             //email người nhận
             $mail->AddBcc("*****@*****.**");
             // Chuẩn bị gửi thư nào
             $mail->FromName = mb_convert_encoding($fullname, "UTF-8", "auto");
             // tên người gửi
             $mail->From = "{$email}";
             // mail người gửi
             $mail->IsHTML(true);
             //Bật HTML không thích thì false
             // Nội dung lá thư
             $mail->Body = "{$tinnhan}";
             // Gửi email
             if ($mail->Send()) {
                 // Gửi không được, đưa ra thông báo lỗi
                 $muser->contact($fullname, $address, $phone, $email, $title, $content);
                 thongbao("Cảm ơn bạn đã liên hệ cho chúng tôi");
                 trangtruoc();
             } else {
                 echo "Không gửi được ";
                 echo "Lỗi: " . $mail->ErrorInfo;
             }
         } else {
             thongbao('Bạn nhập sai chuỗi Captcha');
             trang_truoc();
         }
         $this->_helper->viewRenderer->setNoRender();
         $mask = APPLICATION_PATH . "/../captcha/images/*.png";
         array_map("unlink", glob($mask));
     }
 }
Example #14
0
 function getProfilePath()
 {
     $path = "";
     $view = new Zend_View();
     // $path = '<a href="'.$view->serverUrl($view->baseUrl('user/'.strtolower($this->getUserName()))).'">'.$view->serverUrl($view->baseUrl('user/'.strtolower($this->getUserName()))).'</a>';
     $path = '<a href="javascript: void(0)">' . $view->serverUrl($view->baseUrl('user/' . strtolower($this->getUserName()))) . '</a>';
     return $path;
 }
Example #15
0
 /**
  * get full base url (http://www.example.com/socialstrap)
  */
 public static function getFullBaseUrl($include_base = true)
 {
     $front = Zend_Controller_Front::getInstance();
     $view = new Zend_View();
     if ($include_base) {
         $base_url = $view->baseUrl();
     } else {
         $base_url = '';
     }
     $url = $front->getRequest()->getScheme() . '://' . $front->getRequest()->getHttpHost() . $base_url;
     return $url;
 }
Example #16
0
 /**
  * Generate pages array for Zend_Navigation.
  *
  * @return array
  */
 public static function CreatePluginMenu()
 {
     global $g_user;
     $root_menu = false;
     $plugin_infos = self::GetPluginsInfo(true);
     if ($g_user->hasPermission('plugin_manager')) {
         $root_menu = true;
     }
     foreach ($plugin_infos as $info) {
         if (isset($info['menu']['permission']) && $g_user->hasPermission($info['menu']['permission'])) {
             $root_menu = true;
         } elseif (isset($info['menu']['sub']) && is_array($info['menu']['sub'])) {
             foreach ($info['menu']['sub'] as $menu_info) {
                 if ($g_user->hasPermission($menu_info['permission'])) {
                     $root_menu = true;
                 }
             }
         }
     }
     if (empty($root_menu)) {
         return array();
     }
     $view = new Zend_View();
     $pages = array();
     if ($g_user->hasPermission('plugin_manager')) {
         $pages[] = array('label' => getGS('Manage Plugins'), 'module' => 'admin', 'controller' => 'plugins', 'action' => 'manage.php');
     }
     foreach ($plugin_infos as $info) {
         if (CampPlugin::IsPluginEnabled($info['name'])) {
             $menu_plugin = array();
             $parent_menu = false;
             $Plugin = new CampPlugin($info['name']);
             if (isset($info['menu']['permission']) && $g_user->hasPermission($info['menu']['permission'])) {
                 $parent_menu = true;
             } elseif (isset($info['menu']['sub']) && is_array($info['menu']['sub'])) {
                 foreach ($info['menu']['sub'] as $menu_info) {
                     if ($g_user->hasPermission($menu_info['permission'])) {
                         $parent_menu = true;
                     }
                 }
             }
             if ($parent_menu && isset($info['menu'])) {
                 $uri = '#';
                 if (isset($info['menu']['path'])) {
                     $uri = $view->baseUrl('admin/' . $info['menu']['path']);
                 }
                 $menu_plugin = array('label' => getGS($info['menu']['label']), 'uri' => $uri);
             }
             if (isset($info['menu']['sub']) && is_array($info['menu']['sub'])) {
                 foreach ($info['menu']['sub'] as $menu_info) {
                     if ($g_user->hasPermission($menu_info['permission'])) {
                         $uri = '#';
                         if (isset($menu_info['path'])) {
                             $uri = $view->baseUrl('admin/' . $menu_info['path']);
                         }
                         $menu_item = array('label' => getGS($menu_info['label']), 'uri' => $uri);
                         $menu_plugin['pages'][] = $menu_item;
                     }
                 }
             }
             if (!empty($menu_plugin)) {
                 $pages[] = $menu_plugin;
             }
         }
     }
     return $pages;
 }
Example #17
0
 /**
  * Compile a less file
  *
  * @param \Zend_View $view
  * @param string $href The less file
  * @param boolean $always Always compile
  * @return boolean True when changed
  */
 public function compile(\Zend_View $view, $href, $always = false)
 {
     if (\MUtil_String::startsWith($href, 'http', true)) {
         // When a local url, strip the serverUrl and basepath
         $base = $view->serverUrl() . $view->baseUrl();
         if (\MUtil_String::startsWith($href, $base, true)) {
             // Only strip when urls match
             $href = substr($href, strlen($base));
         }
     }
     // Add full path to the webdir
     $inFile = $this->_webroot . '/' . $href;
     $outFile = substr($inFile, 0, -strlen(pathinfo($inFile, PATHINFO_EXTENSION))) . 'css';
     // Try compiling
     try {
         // \MUtil_Echo::track($inFile, $outFile);
         $lessc = new lessc();
         $lessc->registerFunction('base64encode', array($this, 'base64encode'));
         if ($always || array_key_exists('compilecss', \Zend_Controller_Front::getInstance()->getRequest()->getParams())) {
             $result = (bool) $lessc->compileFile($inFile, $outFile);
         } else {
             $result = $lessc->checkedCompile($inFile, $outFile);
         }
     } catch (\Exception $exc) {
         // If we have an error, present it if not in production
         if (APPLICATION_ENV !== 'production' || APPLICATION_ENV !== 'acceptance') {
             \MUtil_Echo::pre($exc->getMessage());
         }
         $result = null;
     }
     return $result;
 }
Example #18
0
 function preDispatch(Zend_Controller_Request_Abstract $request)
 {
     $auth = Zend_Auth::getInstance();
     if ($auth->hasIdentity()) {
         $info = $auth->getIdentity();
         $level = $info->group_name;
         // luu cookie
         $value = $info->username;
         setcookie("test", $value, time() + 3600);
         // doc cookie
         $test = $this->_request->getCookie('test');
         //        if($test == FALSE){
         //            $auth = Zend_Auth::getInstance();
         //	    $auth->clearIdentity();
         //            $vew=new Zend_View();
         //           $ct= $vew->baseurl('/login/index/login');
         //           chuyen_trang($ct);
         //            }
         $role = "";
         switch ($level) {
             case 1:
                 $role = "seller";
                 break;
             case 2:
                 $role = "user";
                 break;
             case 3:
                 $role = "amo";
                 break;
             default:
                 $role = "admin";
                 break;
         }
     } else {
         $role = '';
     }
     $acl = new Zend_Acl();
     // khai bao cac  nhom phan quyen
     $acl->addRole(new Zend_Acl_Role('amo'))->addRole(new Zend_Acl_Role('user'), 'amo')->addRole(new Zend_Acl_Role('seller'), 'user')->addRole(new Zend_Acl_Role('admin'));
     //Khai bao cac resource (News - blog -production
     $acl->add(new Zend_Acl_Resource('login:index'));
     $acl->add(new Zend_Acl_Resource('default', NULL));
     $acl->add(new Zend_Acl_Resource('default:index'), 'default');
     $acl->add(new Zend_Acl_Resource('default:register'), 'default');
     $acl->add(new Zend_Acl_Resource('default:error'), 'default');
     $acl->add(new Zend_Acl_Resource('default:page'), 'default');
     $acl->add(new Zend_Acl_Resource('default:product'), 'default');
     $acl->add(new Zend_Acl_Resource('error'));
     $acl->add(new Zend_Acl_Resource('error:error'), 'error');
     $acl->add(new Zend_Acl_Resource('admin'));
     $acl->add(new Zend_Acl_Resource('admin:index'), 'admin');
     $acl->add(new Zend_Acl_Resource('admin:link'), 'admin');
     $acl->add(new Zend_Acl_Resource('admin:page'), 'admin');
     $acl->add(new Zend_Acl_Resource('admin:product'), 'admin');
     $acl->add(new Zend_Acl_Resource('admin:side'), 'admin');
     $acl->add(new Zend_Acl_Resource('admin:support'), 'admin');
     $acl->add(new Zend_Acl_Resource('admin:user'), 'admin');
     //khai bao danh sach cac action ma nhom co quyen truy cap
     $acl->allow("amo", "login:index", null);
     $acl->allow("amo", "default", null);
     $acl->allow('amo', "admin:index", "index");
     $acl->deny('amo', "admin", NULL);
     $acl->allow("user", "admin", null);
     $acl->deny('user', "admin:user", null);
     $acl->deny('user', "admin:page", array('listpage', 'listpages'));
     //$acl->deny('user', "admin:user", null);
     $acl->deny('user', "admin:user", null);
     $acl->allow('admin', NULL, NULL);
     $module = $request->getModuleName();
     $controller = $request->getControllerName();
     $action = $request->getActionName();
     //$_pg=$acl->isAllowed($role,$module.':'.$controller,$action);
     if ($role != '') {
         if (!$acl->isAllowed($role, $module . ':' . $controller, $action)) {
             thongbao('Bạn ko có quyền truy cập vào modules này');
             $view = new Zend_View();
             $bse = $view->baseUrl();
             chuyen_trang($bse);
             //var_dump($ada);
         }
     }
 }