Пример #1
0
 /**
  * @var $order array
  * @return array
  */
 public function getComments($order = null)
 {
     $select = $this->allDbAdapter->select();
     $select->from('comments');
     //$select->where('comment_hidden = ?', '0');
     if (isset($order)) {
         $select->order($order);
     } else {
         $select->order(array('comment_product_id', 'comment_order'));
     }
     $comments = $this->allDbAdapter->fetchAll($select->__toString());
     $products = new AdminProducts();
     $array = array();
     foreach ($comments as $comment) {
         $product = $products->getProductById($comment['comment_product_id']);
         if (count($product)) {
             if (isset($array[$product['p_id']])) {
                 $array[$product['p_id']]['comments'][] = $comment;
             } else {
                 $array[$product['p_id']]['name'] = $product['p_title'];
                 $array[$product['p_id']]['id'] = $product['p_id'];
                 $array[$product['p_id']]['comments'][] = $comment;
             }
         } else {
             if (isset($array['others'])) {
                 $array['others']['comments'][] = $comment;
             } else {
                 $array['others']['name'] = 'Comments are not tied to products';
                 $array['others']['class'] = 'hidden';
                 $array['others']['comments'][] = $comment;
             }
         }
     }
     return $array;
 }
Пример #2
0
 public function changelogeditAction()
 {
     $products = new AdminProducts();
     $buildId = $this->_getParam('build');
     $productId = $this->_getParam('id');
     $lang = $this->getParamLang();
     $info = $products->getChangelogByBuildId($buildId, $lang);
     $info = $this->prepareChLogInfo($info);
     $productInfo = $products->getProductById($productId);
     //oas($info);
     $this->tplVars['page_js'][] = 'changelog.js';
     $this->tplVars['chlogdata'] = $info;
     $this->tplVars['prodinfo'] = $productInfo;
     $this->tplVars['otherinfo']['build'] = $info['pb_build'];
     $this->tplVars['otherinfo']['buildid'] = $info['pb_id'];
     $this->tplVars['lvals']['lang'] = $lang;
     $this->tplVars['header']['actions']['names'][] = array('name' => 'changelog', 'menu_name' => 'Product change log', 'params' => array('id' => $this->_getParam('id')));
     $this->tplVars['header']['actions']['names'][] = array('name' => 'changelogedit', 'menu_name' => 'Product change log edit', 'params' => array('build' => $this->_getParam('build'), 'id' => $this->_getParam('id')));
     array_push($this->viewIncludes, 'products/changelogEdit.tpl');
 }