コード例 #1
0
 public function Show($parameters)
 {
     $output = "";
     $ns = new Zend_Session_Namespace();
     $languageID = Languages::get_language_id($ns->lang);
     $mainviewhelper = new Zend_View();
     $mainviewhelper->addBasePath(APPLICATION_PATH . '/modules/default/views/');
     $view = new Zend_View();
     $view->addScriptPath('../library/Shineisp/Custom/views');
     $translator = Shineisp_Registry::getInstance()->Zend_Translate;
     if (!empty($parameters['code'])) {
         $code = $parameters['code'];
     } else {
         return "";
     }
     // Get the products
     $data = Products::GetProductsByGroupCode($code, $languageID);
     // Check the existence of the mandatories attributes
     if (!empty($data['attributes'][0])) {
         $view->attributes = $data['attributes'];
     }
     // Check if there are values set for the group of the product selected
     if (!empty($data['attributes_values'][0])) {
         $view->values = $data['attributes_values'];
     }
     // Get the products
     if (!empty($data['products'][0])) {
         $view->products = $data['products'];
     }
     $view->mainviewhelper = $mainviewhelper;
     // Path of the template
     return $view->render('productsattributes.phtml');
 }
コード例 #2
0
ファイル: Blocks.php プロジェクト: kokkez/shineisp
 /**
  * Iterator
  * Get all the blocks and attach the content within the view called 
  * @param array $blocks
  * @param string $side
  */
 private function Iterator($blocks, $side)
 {
     $ns = new Zend_Session_Namespace('Admin');
     $languageID = Languages::get_language_id($ns->lang);
     if (!empty($blocks['side'])) {
         if ($blocks['side'] == $side) {
             $blocks = $blocks['block'];
             if (count($blocks) > 1) {
                 foreach ($blocks as $block) {
                     $block = CmsBlocks::findbyvar($block['name'], $languageID);
                     if (!empty($block[0]['body'])) {
                         echo $block[0]['body'];
                     }
                 }
             } else {
                 $block = CmsBlocks::findbyvar($blocks['name'], $languageID);
                 if (!empty($block[0]['body'])) {
                     echo $block[0]['body'];
                 } else {
                     echo $blocks['name'] . " block not found.";
                 }
             }
         }
     }
 }
コード例 #3
0
ファイル: ReviewsMap.php プロジェクト: kokkez/shineisp
 public function Show($parameters)
 {
     $view = new Zend_View();
     $view->addScriptPath('../library/Shineisp/Custom/views');
     $ns = new Zend_Session_Namespace();
     $languageID = Languages::get_language_id($ns->lang);
     // Generate the xml file in the public path /documents
     Reviews::getXMLDataMap($languageID);
     return $view->render('reviewsmap.phtml');
 }
コード例 #4
0
ファイル: Reviewslist.php プロジェクト: kokkez/shineisp
 public function Show($parameters)
 {
     $view = new Zend_View();
     $view->addScriptPath('../library/Shineisp/Custom/views');
     $limit = 5;
     $ns = new Zend_Session_Namespace();
     $languageID = Languages::get_language_id($ns->lang);
     $translator = Shineisp_Registry::getInstance()->Zend_Translate;
     if (!empty($parameters['limit']) && is_numeric($parameters['limit'])) {
         $limit = $parameters['limit'];
     }
     $view->data = Reviews::get_random($limit);
     return $view->render('reviewslist.phtml');
 }
コード例 #5
0
ファイル: Productlist.php プロジェクト: kokkez/shineisp
 public function Show($parameters)
 {
     $view = new Zend_View();
     $view->addScriptPath('../library/Shineisp/Custom/views');
     $ns = new Zend_Session_Namespace();
     $languageID = Languages::get_language_id($ns->lang);
     $translator = Shineisp_Registry::getInstance()->Zend_Translate;
     if (!empty($parameters['category']) && is_numeric($parameters['category'])) {
         $id = $parameters['category'];
     } else {
         return "";
     }
     // Get the products
     $view->products = ProductsCategories::getProductListbyCatID($id, "p.product_id, p.uri as uri, pd.name as name, pd.shortdescription as description", $languageID);
     return $view->render('productlist.phtml');
 }
コード例 #6
0
ファイル: Wikilist.php プロジェクト: kokkez/shineisp
 public function Show($parameters)
 {
     $view = new Zend_View();
     $view->addScriptPath('../library/Shineisp/Custom/views');
     $limit = 10;
     $id = null;
     $ns = new Zend_Session_Namespace();
     $languageID = Languages::get_language_id($ns->lang);
     $translator = Shineisp_Registry::getInstance()->Zend_Translate;
     if (!empty($parameters['category']) && is_numeric($parameters['category'])) {
         $id = $parameters['category'];
     }
     if (!empty($parameters['limit']) && is_numeric($parameters['limit'])) {
         $limit = $parameters['limit'];
     }
     // Get the products
     $view->wiki = Wiki::get_items($limit, $id);
     return $view->render('wikilist.phtml');
 }
コード例 #7
0
ファイル: Contents.php プロジェクト: kokkez/shineisp
 /**
  * chkCmsBlocks
  * Replace all the blocks with the cms blocks found
  * 
  * In the cms page you have to write in this way within the text body
  * {block name="homepage"}
  * 
  * @param string $text
  * @return string
  */
 public static function chkCmsBlocks($text, $locale = "en")
 {
     $languageID = Languages::get_language_id($locale);
     // Get all the blocks in the whole text
     $blocks = self::getAllBlocks($text);
     if (!empty($blocks[0])) {
         // For each block do ...
         foreach ($blocks[0] as $block) {
             // Get the information from the block
             preg_match_all('(([a-zA-Z0-9]+)=\\"(.+)\\")Ui', $block, $matches);
             // If the information are correct we get the name of the cms block to load
             if (!empty($matches[2][0])) {
                 // This is the name of the cms block to load from the db
                 $blockname = str_replace("\"", "", $matches[2][0]);
                 // Get the block information
                 $rsblock = CmsBlocks::findbyvar($blockname, $languageID);
                 // Replace the block placeholder with the cmsblock body
                 if (!empty($rsblock[0])) {
                     $text = str_replace($block, $rsblock[0]['body'], $text);
                 } else {
                     $text = str_replace($block, "[ERROR Cms block: {$blockname} doesn't exist.]", $text);
                 }
             }
         }
     }
     return $text;
 }
コード例 #8
0
ファイル: Utilities.php プロジェクト: kokkez/shineisp
 public static function getEmailTemplate($template, $language_id = null)
 {
     $fallbackLocale = "en_US";
     $subject = "";
     $locale = Shineisp_Registry::get('Zend_Locale')->toString();
     if (empty($language_id)) {
         $language_id = Languages::get_language_id($locale);
     } else {
         $locale = Languages::get_locale($language_id);
     }
     $EmailTemplate = EmailsTemplates::findByCode($template, null, false, $language_id);
     // Template missing from DB. Let's add it.
     if (!is_object($EmailTemplate) || !isset($EmailTemplate->EmailsTemplatesData) || !isset($EmailTemplate->EmailsTemplatesData->{0}) || !isset($EmailTemplate->EmailsTemplatesData->{0}->subject)) {
         $filename = PUBLIC_PATH . "/languages/emails/" . $locale . "/" . $template . ".htm";
         // Check if the file exists
         if (!file_exists($filename)) {
             $filename = PUBLIC_PATH . "/languages/emails/" . $fallbackLocale . "/" . $template . ".htm";
             Shineisp_Commons_Utilities::log("This email template has not been found: {$filename}");
             $language_id = 1;
             // set the right default language id
             // Also the fallback template is missing. Something strange is going on.....
             if (!file_exists($filename)) {
                 Shineisp_Commons_Utilities::log("The default email template has not been found: {$filename}");
                 return array('template' => "Template: " . $template . " not found", 'subject' => $template);
             }
         }
         // Get the content of the file
         $body = '';
         foreach (file($filename) as $line) {
             // Get the subject written in the template file
             if (preg_match('/<!--@subject\\s*(.*?)\\s*@-->/', $line, $matches)) {
                 $subject = $matches[1];
                 // Get the subject
                 $subject = trim($subject);
                 continue;
             }
             // Delete all the comments
             $body .= preg_replace('#\\{\\*.*\\*\\}#suU', '', $line);
         }
         $isp = Isp::getActiveISP();
         $body = trim($body);
         $subject = trim($subject);
         // check if the string contains html tags and if it does not contain tags
         // means that it is a simple text. In this case add the tag "<br/>" for each return carrier
         if (!self::isHtml($body)) {
             $body = nl2br($body);
         }
         // Store mail in DB
         $array = array('type' => 'general', 'name' => $template, 'code' => $template, 'plaintext' => 0, 'active' => 1, 'fromname' => is_array($isp) && isset($isp['company']) ? $isp['company'] : 'ShineISP', 'fromemail' => is_array($isp) && isset($isp['email']) ? $isp['email'] : '*****@*****.**', 'subject' => $subject, 'html' => $body);
         // Save the data
         EmailsTemplates::saveAll(null, $array, $language_id);
         // Return the email template
         return array_merge($array, array('template' => $body, 'subject' => $subject));
     }
     // template is numeric but there is not template in db. something strange happened. Exit.
     if (is_numeric($template) && !is_object($EmailTemplate)) {
         return false;
     }
     $email = array('subject' => $EmailTemplate->EmailsTemplatesData->{0}->subject, 'plaintext' => intval($EmailTemplate->plaintext), 'fromname' => $EmailTemplate->EmailsTemplatesData->{0}->fromname, 'fromemail' => $EmailTemplate->EmailsTemplatesData->{0}->fromemail, 'cc' => $EmailTemplate->cc, 'bcc' => $EmailTemplate->bcc, 'template' => '');
     if (!empty($EmailTemplate->EmailsTemplatesData->{0}->html) && !empty($EmailTemplate->EmailsTemplatesData->{0}->text)) {
         // Both version are present
         $body = intval($EmailTemplate->plaintext) ? $EmailTemplate->EmailsTemplatesData->{0}->text : $EmailTemplate->EmailsTemplatesData->{0}->html;
     } else {
         if (empty($EmailTemplate->EmailsTemplatesData->{0}->html) && !empty($EmailTemplate->EmailsTemplatesData->{0}->text)) {
             // Only TEXT version
             $body = $EmailTemplate->EmailsTemplatesData->{0}->text;
         } else {
             // Only HTML version
             $body = $EmailTemplate->EmailsTemplatesData->{0}->html;
         }
     }
     $email['template'] = $body;
     return $email;
 }