Exemple #1
0
 public function indexAction()
 {
     $ns = new Zend_Session_Namespace();
     $locale = $ns->lang;
     Shineisp_Commons_Utilities::log("ShineISP starts now from " . $_SERVER['SERVER_ADDR']);
     if (empty($ns->customer)) {
         $this->view->dashboard = true;
     } else {
         $this->view->dashboard = false;
     }
     $this->view->mex = $this->getRequest()->getParam('mex');
     $this->view->mexstatus = $this->getRequest()->getParam('status');
     // Call the static Homepage
     $homepage = CmsPages::findbyvar("homepage", $locale);
     if (!empty($homepage['body'])) {
         // Set the custom layout of the page
         if (!empty($homepage['pagelayout'])) {
             $this->getHelper('layout')->setLayout($homepage['pagelayout']);
         }
         // Set the keywords of the page
         if (!empty($homepage['keywords'])) {
             $this->view->headMeta()->setName('keywords', $homepage['keywords']);
         }
         // Set the body of the page
         $this->view->content = $homepage['body'];
     }
     $this->view->headertitle = "S: " . Shineisp_Registry::get('ISP')->slogan;
 }
Exemple #2
0
 public function init()
 {
     // Here we define query conditions.
     $criteria = new CDbCriteria();
     $criteria->limit = 2;
     $criteria->condition = '`status` = 1';
     //$criteria->order = '`position` ASC';
     $items = CmsPages::model()->findAll($criteria);
     //echo "items"."<pre>";print_r($items);die;
     foreach ($items as $item) {
         $this->items[] = array('label' => $item->title, 'url' => Yii::app()->createUrl("user/pages", array('id' => $item->id)));
     }
     // footer
     /* $criteria1 = new CDbCriteria;
             
             $criteria1->condition = '`status` = 1';
             //$criteria->order = '`position` ASC';
     
             $footeritems = CmsPages::model()->findAll($criteria1);
             //echo "items"."<pre>";print_r($footeritems);die;
             foreach ($footeritems as $footer)
                 $this->items[] = array('label'=>$footer->title, 'url'=>Yii::app()->createUrl("user/pages",array('id'=>$footer->id)));
              */
     parent::init();
 }
Exemple #3
0
 public function init()
 {
     // Set the custom decorator
     $this->addElementPrefixPath('Shineisp_Decorator', 'Shineisp/Decorator/', 'decorator');
     $translate = Shineisp_Registry::get('Zend_Translate');
     $this->addElement('text', 'title', array('filters' => array('StringTrim'), 'required' => false, 'decorators' => array('Bootstrap'), 'label' => $translate->_('Title'), 'class' => 'form-control'));
     $this->addElement('textarea', 'body', array('filters' => array('StringTrim'), 'decorators' => array('Bootstrap'), 'label' => $translate->_('Body'), 'class' => 'form-control col-lg-12'));
     $this->addElement('text', 'var', array('filters' => array('StringTrim'), 'decorators' => array('Bootstrap'), 'label' => $translate->_('URL-Key'), 'description' => $translate->_('This is the name of the page. For multilanguages website you can create more page with the same Url-key with different languages.'), 'rows' => 5, 'class' => 'form-control'));
     $this->addElement('textarea', 'keywords', array('filters' => array('StringTrim'), 'decorators' => array('Bootstrap'), 'label' => $translate->_('Keywords'), 'rows' => 5, 'description' => $translate->_('separate each keyword by a comma'), 'class' => 'col-lg-12 form-control'));
     $this->addElement('textarea', 'blocks', array('filters' => array('StringTrim'), 'decorators' => array('Bootstrap'), 'label' => $translate->_('Blocks'), 'class' => 'form-control'));
     $this->addElement('textarea', 'xmllayout', array('filters' => array('StringTrim'), 'decorators' => array('Bootstrap'), 'label' => $translate->_('XML Layout'), 'class' => 'form-control'));
     $this->addElement('checkbox', 'blog', array('filters' => array('StringTrim'), 'decorators' => array('Bootstrap'), 'label' => $translate->_('is Blog post'), 'class' => 'form-control'));
     $this->addElement('select', 'parent_id', array('decorators' => array('Bootstrap'), 'label' => $translate->_('Parent'), 'class' => 'form-control'));
     $this->getElement('parent_id')->setAllowEmpty(false)->setRegisterInArrayValidator(false)->setMultiOptions(CmsPages::getList(true));
     $this->addElement('select', 'layout', array('decorators' => array('Bootstrap'), 'label' => $translate->_('Content layouts'), 'class' => 'form-control'));
     $this->getElement('layout')->setAllowEmpty(false)->setRegisterInArrayValidator(false)->setMultiOptions(CmsPages::getLayouts());
     $this->addElement('select', 'pagelayout', array('decorators' => array('Bootstrap'), 'label' => $translate->_('Page layouts'), 'class' => 'form-control'));
     $this->getElement('pagelayout')->setAllowEmpty(false)->setRegisterInArrayValidator(false)->setMultiOptions(CmsPages::getPageLayouts());
     $this->addElement('multiselect', 'language_id', array('decorators' => array('Bootstrap'), 'label' => $translate->_('Language'), 'title' => $translate->_('Select ...'), 'data-container' => 'body', 'data-selected-text-format' => 'count > 3', 'data-size' => 'auto', 'data-live-search' => 'true', 'class' => 'multiselect show-tick col-md-4 col-sm-4'));
     $this->getElement('language_id')->setAllowEmpty(false)->setRegisterInArrayValidator(false)->setMultiOptions(Languages::getList());
     $this->addElement('checkbox', 'showinmenu', array('decorators' => array('Bootstrap'), 'label' => $translate->_('Show in the navigation menu'), 'class' => 'form-control'));
     $this->addElement('checkbox', 'showonrss', array('decorators' => array('Bootstrap'), 'label' => $translate->_('Publish on RSS Feed'), 'class' => 'form-control'));
     $this->addElement('checkbox', 'active', array('decorators' => array('Bootstrap'), 'label' => $translate->_('Active'), 'class' => 'form-control'));
     $this->addElement('hidden', 'page_id');
 }
Exemple #4
0
 /** 
  * Create a CMS menu
  * @param unknown_type $parent
  * @param unknown_type $locale
  * @return string
  */
 private function createMenu($parent)
 {
     $locale = $this->translator->getAdapter()->getLocale();
     $children = CmsPages::getParent($parent, $locale);
     $items = array();
     if (is_array($children)) {
         foreach ($children as $row) {
             $link = !empty($row['link']) ? $row['link'] : "/cms/" . $row['var'] . ".html";
             $items[] = "<li class=\"dropdown\"><a href=\"" . $link . "\">" . $row['title'] . "</a>" . $this->createMenu($row['page_id']) . "</li>";
         }
     }
     if (count($items)) {
         return "<ul class=\"dropdown-menu\">" . implode('', $items) . "</ul>";
     } else {
         return '';
     }
 }
Exemple #5
0
 /**
  * Create a RSS file with the CMS pages and Products
  */
 public function indexAction()
 {
     $out = "";
     try {
         $ISP = Shineisp_Registry::get('ISP');
         $ns = new Zend_Session_Namespace();
         $localeID = $ns->idlang;
         $locale = $ns->lang;
         $feed = new Zend_Feed_Writer_Feed();
         $feed->setTitle($ISP->company);
         $feed->setLink($ISP->website);
         $feed->setFeedLink('http://' . $_SERVER['HTTP_HOST'] . '/rss', 'atom');
         $feed->addAuthor(array('name' => $ISP->company, 'email' => $ISP->email, 'uri' => $ISP->website));
         $feed->setEncoding('UTF8');
         $feed->setDateModified(time());
         $feed->addHub($ISP->website);
         // Get all the cms pages
         $records = CmsPages::getRssPages($locale);
         foreach ($records as $record) {
             $link = 'http://' . $_SERVER['HTTP_HOST'] . '/cms/' . $record['var'] . '.html';
             self::createEntry($feed, $record['title'], $record['body'], $link);
         }
         // Get all the products
         $records = Products::getAllHighlighted($localeID);
         foreach ($records as $record) {
             $title = $record['ProductsData'][0]['name'];
             $descritption = strip_tags($record['ProductsData'][0]['shortdescription']);
             $inserted_at = !empty($record['inserted_at']) ? strtotime($record['inserted_at']) : null;
             $updated_at = !empty($record['updated_at']) ? strtotime($record['updated_at']) : null;
             $link = 'http://' . $_SERVER['HTTP_HOST'] . '/' . $record['uri'] . '.html';
             self::createEntry($feed, $title, $descritption, $link, $inserted_at, $updated_at);
         }
         /**
          * Render the resulting feed to Atom 1.0 and assign to $out.
          * You can substitute "atom" with "rss" to generate an RSS 2.0 feed.
          */
         $out = $feed->export('atom');
     } catch (Zend_Feed_Exception $e) {
         die($e->getMessage());
     }
     die($out);
 }
Exemple #6
0
 private function CreateSubHeader($page)
 {
     $data = array();
     $translation = Shineisp_Registry::getInstance()->Zend_Translate;
     $locale = $translation->getAdapter()->getLocale();
     if (strlen($locale) == 2) {
         $locale = $locale . "_" . strtoupper($locale);
     }
     if (is_array($page)) {
         $pages = CmsPages::getParent($page['page_id'], $locale);
         // Set the title of the subheader
         $data['title'] = $page['title'];
         // Set the menu of the subheader
         if (count($pages) > 0) {
             foreach ($pages as $item) {
                 $link = !empty($item['link']) ? $item['link'] : $item['var'];
                 $data['subitems'][] = array('link' => $link, 'label' => $item['title']);
             }
         }
     }
     return $data;
 }
Exemple #7
0
 /**
  * 
  * Save the Cms page data
  */
 public static function saveAll($id, $params, $locale = 1)
 {
     $i = 0;
     // Set the new values
     if (is_numeric($id)) {
         $cmspages = Doctrine::getTable('Cmspages')->find($id);
     } else {
         $cmspages = new CmsPages();
         $cmspages->publishedat = date('Y-m-d H:i:s');
     }
     $cmspages->title = $params['title'];
     $cmspages->body = $params['body'];
     $cmspages->keywords = $params['keywords'];
     $cmspages->blocks = $params['blocks'];
     $cmspages->layout = $params['layout'];
     $cmspages->xmllayout = $params['xmllayout'];
     $cmspages->var = !empty($params['var']) ? Shineisp_Commons_UrlRewrites::format($params['var']) : Shineisp_Commons_UrlRewrites::format($params['title']);
     $cmspages->pagelayout = $params['pagelayout'];
     $cmspages->parent_id = $params['parent_id'];
     $cmspages->showinmenu = $params['showinmenu'] ? true : false;
     $cmspages->showonrss = $params['showonrss'] ? true : false;
     $cmspages->blog = $params['blog'] ? true : false;
     $cmspages->showonrss = $params['showonrss'] ? true : false;
     $cmspages->active = $params['active'] ? true : false;
     if ($cmspages->trySave()) {
         if (is_numeric($cmspages['page_id'])) {
             // Clear old reference records by page_id
             CmsPagesData::deleteItems($cmspages['page_id']);
             // Save the page translation references
             $PageData = new Doctrine_Collection('CmsPagesData');
             foreach ($params['language_id'] as $idlang) {
                 $PageData[$i]->page_id = $cmspages['page_id'];
                 $PageData[$i]->language_id = $idlang;
                 $i++;
             }
             $PageData->save();
         }
     }
     $id = is_numeric($id) ? $id : $cmspages->getIncremented();
     return $id;
 }
Exemple #8
0
 public function actionAjaxCmsDeactivate()
 {
     $id = $_REQUEST['id'];
     $rec = CmsPages::model()->findByPk($id);
     $status = $rec->status;
     //echo $status;die;
     if ($status == 1) {
         $rec->status = 0;
         $rec->save();
     } else {
         $rec->status = 1;
         $rec->save();
     }
 }
Exemple #9
0
 public function actionContact()
 {
     $model = new ContactForm();
     if (isset($_POST['ContactForm'])) {
         $model->attributes = $_POST['ContactForm'];
         if ($model->validate()) {
             $subject = 'Welcome to Wow Cleans';
             $body = $this->renderPartial('contactEmail', array('model' => $model), true);
             //echo "<pre>";print_r($body);die;
             Yii::app()->mailer->send($model->email, $subject, $body);
             Yii::app()->user->setFlash('success', "Successfully send your message.");
             $this->refresh();
         } else {
             $errors = $model->getErrors();
             //echo var_dump($errors);
         }
     }
     $links = CmsPages::model()->findAll();
     Yii::app()->params['MyArray'] = $links;
     $this->render('contact', array('model' => $model));
 }
Exemple #10
0
 public function actionThanks($param1)
 {
     $res = CustomerBooking::model()->findByPk($param1);
     //echo "<pre>";print_r($res);die;
     $links = CmsPages::model()->findAll();
     Yii::app()->params['MyArray'] = $links;
     $this->render('thanks', array('detail' => $res));
 }
 public function actionChnagequotesDashboardSpeciUser()
 {
     //$id      =$_REQUEST['id'];
     $admin = new ParticularPrice();
     $adnl = new AdditionalParticularPrice();
     $price = new ParticularPrice();
     $loggedId = Yii::app()->session['loggedId'];
     $providerId = CompanyRequest::model()->findByPk(array('id' => $id));
     $bookId = $providerId['booking_id'];
     $bookingrec = Booking::model()->findByPk(array('id' => $bookId));
     //echo "<pre>";print_r($bookingrec);die;
     $servicetype = $bookingrec['service_type_id'];
     $provId = $bookingrec['service_id'];
     // echo $bookingId;die;
     $priceAdmin = PriceAdmin::model()->find(array('condition' => 'service_id=:service_id AND service_type_id=:service_type_id', 'params' => array(':service_id' => $provId, ':service_type_id' => $servicetype)));
     $addPriceDetl = AdditionalServicePrice::model()->findAll(array('condition' => 'service_id=:service_id', 'params' => array(':service_id' => $provId)));
     $particularRec = ParticularPrice::model()->find(array('condition' => 'booking_id=:booking_id', 'params' => array(':booking_id' => $_REQUEST['booking_id'])));
     /*code to save the particular quote*/
     if (isset($_REQUEST['ParticularPrice'])) {
         $partiRecord = ParticularPrice::model()->find(array('condition' => 'booking_id=:booking_id', 'params' => array(':booking_id' => $_REQUEST['booking_id'])));
         if (!empty($partiRecord)) {
             //echo "<pre>";print_r($_REQUEST);die;
             $priceParticular = ParticularPrice::model()->find(array('condition' => 'booking_id=:booking_id', 'params' => array(':booking_id' => $_REQUEST['booking_id'])));
             foreach ($_REQUEST['ParticularPrice'] as $k => $p) {
                 if ($k == "bedroom") {
                     $modifiedKey = "Bedrooms";
                 } else {
                     if ($k == "bathroom") {
                         $modifiedKey = "Bathrooms";
                     } else {
                         if ($k == "property") {
                             $modifiedKey = "Property";
                         } else {
                             if ($k == "desk") {
                                 $modifiedKey = "Desk";
                             }
                         }
                     }
                 }
                 $firstArrayVal = $_REQUEST['noBedBathDesk'][$modifiedKey];
                 $newAr[] = $firstArrayVal * $p;
                 $priceParticular->{$k} = $p;
                 // $k++;
             }
             $result = array_sum($newAr);
             $priceParticular->particular_price = $result;
             $priceParticular->save(false);
             /*chnage the details for additional particular prices*/
             $additionalPartiPrice = AdditionalParticularPrice::model()->findAll(array('condition' => 'booking_id=:booking_id', 'params' => array(':booking_id' => $_REQUEST['booking_id'])));
             //foreach($additionalPartiPrice)
             //echo "<pre>";print_r($additionalPartiPrice);die;
             if (!empty($_REQUEST['AdditionalParticularPrice'])) {
                 //echo "<pre>";print_r($_REQUEST);die;
                 /* foreach($additionalPartiPrice as $key=>$edit)
                 				              {
                 				              	  //echo "<pre>";print_r($edit);
                 				              	       foreach($_REQUEST['AdditionalParticularPrice'] as $k=>$adnlprice)
                 						              {
                 						                  //echo "<pre>";print_r($adnlprice);      
                 						                  if($edit['additional_service_id']==$k)
                 						                  {	
                 						                     $edit->price                =$adnlprice;
                 						                  } 
                 						                  // $sum = 0;
                 						                  foreach($_REQUEST['adnl'] as $tot)
                 						                  {
                 						                      $arr[] =$tot*$adnlprice;
                 						                      $res =array_sum($arr);
                 
                 						                  }
                 						                   $edit->total_price=$res+$result;
                 						                   $edit->save(false);
                 						                                  
                 						                      $res=array(); 
                 						                      $arr=array(); 
                 						                 					                 
                 						              }
                 				              	 
                 				              } */
                 foreach ($additionalPartiPrice as $key => $edit) {
                     foreach ($_REQUEST['AdditionalParticularPrice'] as $k => $adnlprice) {
                         $edit->price = $adnlprice;
                         $total = array();
                         foreach ($_REQUEST['AdditionalParticularPrice'] as $key => $adnlpr) {
                             $total[] = $adnlpr * $_REQUEST['adnl'][$key];
                             //echo "<pre>";print_r($total);
                         }
                         //die;
                         $sum1 = array_sum($total);
                         $edit->total_price = $sum1 + $result;
                         $edit->save(false);
                     }
                 }
             }
             /* mail to customer*/
             $subject = 'Welcome to Wow Cleans';
             $body = $this->renderPartial('chnagequoteparticularCustomerEmail', array('model' => $partiRecord), true);
             Yii::app()->mailer->send($partiRecord->customer['email'], $subject, $body);
             /*mail to company */
             $subject = 'Welcome to Wow Cleans';
             $body = $this->renderPartial('chnagequoteparticularCustomerEmail', array('model' => $partiRecord), true);
             Yii::app()->mailer->send($partiRecord->customer['email'], $subject, $body);
             $this->redirect(array('dashboard'));
         } else {
             $price->customer_id = $_REQUEST['customer_id'];
             $price->service_id = $loggedId;
             $price->booking_id = $_REQUEST['booking_id'];
             $price->date = date('Y-m-d');
             //$k=0;
             foreach ($_REQUEST['ParticularPrice'] as $k => $p) {
                 if ($k == "bedroom") {
                     $modifiedKey = "Bedrooms";
                 } else {
                     if ($k == "bathroom") {
                         $modifiedKey = "Bathrooms";
                     } else {
                         if ($k == "property") {
                             $modifiedKey = "Property";
                         } else {
                             if ($k == "desk") {
                                 $modifiedKey = "Desk";
                             }
                         }
                     }
                 }
                 $firstArrayVal = $_REQUEST['noBedBathDesk'][$modifiedKey];
                 $newAr[] = $firstArrayVal * $p;
                 $price->{$k} = $p;
                 // $k++;
             }
             $result = array_sum($newAr);
             $price->particular_price = $result;
             $price->save(false);
             if (!empty($_REQUEST['AdditionalParticularPrice'])) {
                 /*   foreach($_REQUEST['AdditionalParticularPrice'] as $k=>$adnlprice)
                 					               {
                 					                  $adnl    =new AdditionalParticularPrice; 
                 					                  $adnl->service_id           =$loggedId;
                 					                  $adnl->customer_id          =$_REQUEST['customer_id'];
                 					                  $adnl->booking_id           =$_REQUEST['booking_id']; 
                 					                  $adnl->date                 =date('Y-m-d'); 
                 					                  $adnl->additional_service_id=$k;
                 					                  
                 					                  $adnl->price                =$adnlprice;
                 					                  // $sum = 0;
                 					                  foreach($_REQUEST['adnl'] as $tot)
                 					                  {
                 					                      $arr[] =$tot*$adnlprice;
                 					                      $res =array_sum($arr);
                 
                 					                  }
                 					                   $adnl->total_price=$res+$result;
                 					                   $adnl->save(false);
                 					                                  
                 					                      $res=array(); 
                 					                      $arr=array(); 
                 					                  
                 					                 
                 					              } */
                 //$total = array();
                 foreach ($_REQUEST['AdditionalParticularPrice'] as $k => $adnlprice) {
                     $adnl = new AdditionalParticularPrice();
                     $adnl->service_id = $loggedId;
                     $adnl->customer_id = $_REQUEST['customer_id'];
                     $adnl->booking_id = $_REQUEST['booking_id'];
                     $adnl->date = date('Y-m-d');
                     $adnl->additional_service_id = $k;
                     $adnl->price = $adnlprice;
                     $total = array();
                     foreach ($_REQUEST['AdditionalParticularPrice'] as $key => $adnlpr) {
                         $total[] = $adnlpr * $_REQUEST['adnl'][$key];
                         //echo "<pre>";print_r($total);
                     }
                     //die;
                     $sum1 = array_sum($total);
                     $adnl->total_price = $sum1 + $result;
                     $adnl->save(false);
                 }
                 //die;
             }
             //die("fsdfsd");
             /* mail to customer*/
             $subject = 'Welcome to Wow Cleans';
             $body = $this->renderPartial('chnagequoteparticularCustomerEmail', array('model' => $particularRec), true);
             Yii::app()->mailer->send($partiRecord->customer['email'], $subject, $body);
             /*mail to company */
             $subject = 'Welcome to Wow Cleans';
             $body = $this->renderPartial('chnagequoteparticularCustomerEmail', array('model' => $particularRec), true);
             Yii::app()->mailer->send($partiRecord->customer['email'], $subject, $body);
             $this->redirect(array('dashboard'));
         }
         //$price
         // echo "<pre>";print_r($_REQUEST);die;
     }
     $links = CmsPages::model()->findAll();
     Yii::app()->params['MyArray'] = $links;
     $this->render('chnagequotesDashboardSpeciUser', array('bookingrec' => $bookingrec, 'priceAdmin' => $priceAdmin, 'admin' => $admin, 'addPriceDetl' => $addPriceDetl, 'adnl' => $adnl, 'particularRec' => $particularRec));
 }
Exemple #12
0
 public function actionCmsEdit($id)
 {
     ob_start();
     Yii::app()->theme = 'back';
     $model = new CmsPages();
     // echo "<pre>";print_r($_REQUEST);die;
     $cmsedit = CmsPages::model()->findByAttributes(array('id' => $id));
     // echo "<pre>";print_r($_REQUEST);die;
     if (isset($_POST['CmsPages'])) {
         $model->attributes = $_POST['CmsPages'];
         if ($model->validate()) {
             $res = CMSPages::model()->findByAttributes(array('id' => $id));
             $title = $_REQUEST['CmsPages']['title'];
             $meta = $_REQUEST['CmsPages']['meta_title'];
             $desc = $_REQUEST['CmsPages']['desc'];
             $res->title = $title;
             $res->meta_title = $meta;
             $res->desc = $desc;
             if ($res->save()) {
                 $this->redirect(array('cmslisting'));
             }
         } else {
             $errors = $model->getErrors();
             //var_dump($errors);
         }
     }
     $this->render('cmsedit', array('edit' => $cmsedit, 'model' => $model));
 }
Exemple #13
0
 /**
  * Prepare the newsletter content
  */
 private static function fill_content()
 {
     $ns = new Zend_Session_Namespace();
     $contents = array();
     // Get all the products
     $contents['products'] = "<ul>";
     $records = Products::getAllHighlighted($ns->idlang);
     foreach ($records as $record) {
         $contents['products'] .= "<b><a href='http://" . $_SERVER['HTTP_HOST'] . "/" . $record['uri'] . ".html'>" . $record['ProductsData'][0]['name'] . "</a></b><p>" . $record['ProductsData'][0]['shortdescription'] . "</p>";
     }
     $contents['products'] .= "</ul>";
     // Get all the cms pages
     $contents['pages'] = "";
     $records = CmsPages::getRssPages($ns->lang);
     foreach ($records as $record) {
         $link = 'http://' . $_SERVER['HTTP_HOST'] . '/cms/' . $record['var'] . '.html';
         $contents['pages'] .= "<p><b><a href='" . $link . "'>" . $record['title'] . "</a></b></p>";
         $contents['pages'] .= Shineisp_Commons_Utilities::truncate($record['body'], 200, "...", false, true);
     }
     $contents['pages'] = str_replace("src=\"/", "src=\"http://" . $_SERVER['HTTP_HOST'] . "/", $contents['pages']);
     return $contents;
 }
 /**
  * processAction
  * Update the record previously selected
  * @return unknown_type
  */
 public function processAction()
 {
     $redirector = Zend_Controller_Action_HelperBroker::getStaticHelper('redirector');
     $form = $this->getForm("/admin/cmspages/process");
     $request = $this->getRequest();
     // Create the buttons in the edit form
     $this->view->buttons = array(array("url" => "#", "label" => $this->translator->translate('Save'), "params" => array('css' => null, 'id' => 'submit')), array("url" => "/admin/cmspages/list", "label" => $this->translator->translate('List'), "params" => array('css' => null, 'id' => 'submit')), array("url" => "/admin/cmspages/new/", "label" => $this->translator->translate('New'), "params" => array('css' => null)));
     // Check if we have a POST request
     if (!$request->isPost()) {
         return $this->_helper->redirector('list', 'cmspages', 'admin');
     }
     if ($form->isValid($request->getPost())) {
         // Get the id
         $id = $this->getRequest()->getParam('page_id');
         // Get the values posted
         $params = $form->getValues();
         $id = CmsPages::saveAll($id, $params);
         $this->_helper->redirector('edit', 'cmspages', 'admin', array('id' => $id, 'mex' => $this->translator->translate('The task requested has been executed successfully.'), 'status' => 'success'));
     } else {
         $this->view->form = $form;
         $this->view->title = $this->translator->translate("CMS Pages Details");
         $this->view->description = $this->translator->translate("Here you can reply to all the customers requests");
         return $this->render('applicantform');
     }
 }
Exemple #15
0
 /**
  * Create the form module in order to create a record
  * @return unknown_type
  */
 public function doAction()
 {
     $request = $this->getRequest();
     $q = $request->getParam('q');
     $results = array();
     $q = strtolower($q);
     if (empty($q)) {
         die(json_encode(array($this->translator->translate('No Records'))));
     }
     $cms = CmsPages::getList();
     foreach ($cms as $key => $value) {
         if (strpos(strtolower($value), $q) !== false) {
             $results[] = array('icon' => 'glyphicon-file', 'section' => $this->translator->translate('Cms'), 'value' => $value, 'url' => "/admin/cmspages/edit/id/{$key}", 'tokens' => explode(' ', $value));
         }
     }
     $customers = Customers::getList();
     if (!empty($customers)) {
         foreach ($customers as $key => $value) {
             if (strpos(strtolower($value), $q) !== false) {
                 $results[] = array('icon' => 'glyphicon-user', 'section' => $this->translator->translate('Customer'), 'value' => $value, 'url' => "/admin/customers/edit/id/{$key}", 'tokens' => explode(' ', $value));
             }
         }
     }
     $domains = Domains::getList();
     if (!empty($domains)) {
         foreach ($domains as $key => $value) {
             if (strpos(strtolower($value), $q) !== false) {
                 $results[] = array('icon' => 'glyphicon-globe', 'section' => $this->translator->translate('Domain'), 'value' => $value, 'url' => "/admin/domains/edit/id/{$key}", 'tokens' => explode(' ', $value));
             }
         }
     }
     $products = Products::getList();
     if (!empty($products)) {
         foreach ($products as $key => $value) {
             if (strpos(strtolower($value), $q) !== false) {
                 $results[] = array('icon' => 'glyphicon-barcode', 'section' => $this->translator->translate('Product'), 'value' => $value, 'url' => "/admin/products/edit/id/{$key}", 'tokens' => explode(' ', $value));
             }
         }
     }
     $orders = Orders::getList();
     if (!empty($orders)) {
         foreach ($orders as $key => $value) {
             if (strpos(strtolower($value), $q) !== false) {
                 $results[] = array('icon' => 'glyphicon-briefcase', 'section' => $this->translator->translate('Order'), 'value' => $value, 'url' => "/admin/orders/edit/id/{$key}", 'tokens' => explode(' ', $value));
             }
         }
     }
     $ordersitems = OrdersItems::getItemsListbyDescription($q);
     if (!empty($ordersitems)) {
         foreach ($ordersitems as $key => $value) {
             $results[] = array('icon' => 'glyphicon-briefcase', 'section' => $this->translator->translate('Order Item'), 'value' => $value, 'url' => "/admin/ordersitems/edit/id/{$key}", 'tokens' => explode(' ', $value));
         }
     }
     $tickets = Tickets::getList();
     if (!empty($tickets)) {
         foreach ($tickets as $key => $value) {
             if (strpos(strtolower($value), $q) !== false) {
                 $results[] = array('icon' => 'glyphicon-check', 'section' => $this->translator->translate('Ticket'), 'value' => $value, 'url' => "/admin/tickets/edit/id/{$key}", 'tokens' => explode(' ', $value));
             }
         }
     }
     $wiki = Wiki::getList();
     if (!empty($wiki)) {
         foreach ($wiki as $key => $value) {
             if (strpos(strtolower($value), $q) !== false) {
                 $results[] = array('icon' => 'glyphicon-question-sign', 'section' => $this->translator->translate('Wiki'), 'value' => $value, 'url' => "/admin/wiki/edit/id/{$key}", 'tokens' => explode(' ', $value));
             }
         }
     }
     $ticket = TicketsNotes::getItemsNote($q);
     foreach ($ticket as $key => $value) {
         $results[] = array('icon' => 'glyphicon-question-sign', 'section' => $this->translator->translate('Ticket Notes'), 'value' => $value, 'url' => "/admin/wiki/tickets/id/{$key}", 'tokens' => explode(' ', $value));
     }
     die(json_encode($results));
 }
Exemple #16
0
 /**
  * showblock
  * Handle the Cms blocks and XML Blocks 
  * @param unknown_type $side
  */
 public function showblock($side)
 {
     $ns = new Zend_Session_Namespace();
     $languageID = $ns->langid;
     $record = array();
     $blocks = array();
     // Get the main variables
     $module = Zend_Controller_Front::getInstance()->getRequest()->getModuleName();
     $controller = Zend_Controller_Front::getInstance()->getRequest()->getControllerName();
     $action = Zend_Controller_Front::getInstance()->getRequest()->getActionName();
     $customskin = Settings::findbyParam('skin');
     $skin = !empty($customskin) ? $customskin : "blank";
     // call the placeholder view helper for each side parsed
     echo $this->view->placeholder($side);
     // Get all the xml blocks
     $xmlblocks = Shineisp_Commons_Layout::getBlocks($module, $side, $controller, $skin);
     // HOMEPAGE BLOCKS
     // If the controller called is the homepage, event detail page or a cms page ...
     // #################
     if ($controller == "index") {
         $record = CmsPages::findbyvar('homepage', $ns->lang);
         $var = Zend_Controller_Front::getInstance()->getRequest()->getParam('url');
         if (!empty($var)) {
             $record = CmsPages::findbyvar($var, $ns->lang);
         }
     } elseif ($controller == "cms") {
         $var = Zend_Controller_Front::getInstance()->getRequest()->getParam('url');
         $record = CmsPages::findbyvar($var, $ns->lang);
     }
     // Load the xml found in the recordset
     if (!empty($record['blocks'])) {
         // Load the xml into an array
         $xmlobject = simplexml_load_string($record['blocks']);
         // Get the blocks from the xml structure
         if (count($xmlobject)) {
             $i = 0;
             foreach ($xmlobject as $block) {
                 $blocks['reference'][$i]['block']['name'] = (string) $block;
                 $blocks['reference'][$i]['side'] = (string) $block['side'];
                 $blocks['reference'][$i]['position'] = (string) $block['position'];
                 $i++;
             }
         }
     }
     // Join every block in one unique blocks structure
     if (!empty($xmlblocks)) {
         if (!empty($blocks['reference'])) {
             $blocks['reference'] = array_merge($xmlblocks, $blocks['reference']);
         } else {
             $blocks['reference'] = $xmlblocks;
         }
     }
     if (!empty($blocks['reference'])) {
         $blocks['reference'] = Shineisp_Commons_Utilities::columnSort($blocks['reference'], 'position');
     }
     if (isset($blocks['reference']['block'])) {
         $this->Iterator($blocks['reference'], $side);
     } elseif (isset($blocks['reference'][0])) {
         foreach ($blocks['reference'] as $block) {
             $this->Iterator($block, $side);
         }
     }
     if (Settings::findbyParam('debug')) {
         echo "<div class=\"alert alert-info\"><h4>{$side} <small>({$skin})</small></h4>Path: {$module}/{$controller}/{$action}</div>";
     }
     $this->view->module = $module;
     $this->view->controller = $controller;
     $this->view->action = $action;
 }