コード例 #1
0
 public function indexAction()
 {
     $this->view->pageTitle = Axis::translate('sitemap')->__('Sitemap');
     $this->view->sitesList = Axis::single('core/site')->fetchAll()->toArray();
     $this->view->crawlers = array_values(Axis::model('sitemap/crawler')->toArray());
     $this->render();
 }
コード例 #2
0
ファイル: Ratings.php プロジェクト: baisoo/axiscommerce
 /**
  * Build rating stars, according to recieved ratings array
  *
  * @param array $ratings
  *  array(
  *      array(
  *          'mark' => int,
  *          'title' => string,
  *          'product_id' => int[optional]
  *      ),...
  *  )
  * @param string $url [optional]
  * @param boolean $smallStars [optional]
  * @return string
  */
 public function ratings($ratings, $url = '', $smallStars = true)
 {
     if (isset($this->_config['rating_enabled']) && !$this->_config['rating_enabled']) {
         return '';
     }
     if (!is_array($ratings)) {
         $ratings = array();
     }
     $url = empty($url) ? '#' : $url;
     $hasRating = false;
     $html = '';
     foreach ($ratings as $rating) {
         if (!count($rating)) {
             continue;
         }
         $hasRating = true;
         $html .= '<li>';
         $html .= $this->_getRatingTitle($rating['title']);
         $html .= '<a href="' . $url . '" class="review-stars review-rate' . ($smallStars ? '-sm' : '') . ' "title="' . $rating['title'] . ': ' . $rating['mark'] . ' ' . Axis::translate('community')->__('stars') . '">
                   <span style="width: ' . $rating['mark'] * 100 / 5 . '%">' . Axis::translate('community')->__("%s stars", $rating['mark']) . '</span>
         </a>';
         $html .= '</li>';
     }
     if ($hasRating) {
         $html = '<ul class="review-ratings">' . $html . '</ul>';
     }
     return $html;
 }
コード例 #3
0
 public function registerAction()
 {
     if (Axis::getCustomerId()) {
         $this->_redirect('account');
     }
     $this->setTitle(Axis::translate('account')->__('Create an Account'));
     $form = Axis::single('account/form_signup');
     if ($this->getRequest()->isPost()) {
         $data = $this->getRequest()->getPost();
         if ($form->isValid($data)) {
             $model = Axis::single('account/customer');
             $data['site_id'] = Axis::getSiteId();
             $data['is_active'] = 1;
             list($row, $password) = $model->create($data);
             $row->setDetails($data);
             Axis::dispatch('account_customer_register_success', array('customer' => $row, 'password' => $password));
             $model->login($data['email'], $password);
             return $this->_redirect('account');
         } else {
             $form->populate($data);
         }
     }
     $this->view->formSignup = $form;
     $this->render();
 }
コード例 #4
0
 /**
  *
  * @param mixed $value
  * @return mixed
  */
 public static function getSaveValue($value)
 {
     if (!is_array($value)) {
         return $value;
     }
     function remove_quotes(&$str)
     {
         $str = str_replace(array('"', "'"), '', $str);
     }
     $filename = Axis::config()->system->path . '/var/export/' . current($value);
     if (@(!($fp = fopen($filename, 'r')))) {
         Axis::message()->addError(Axis::translate('core')->__("Can't open file : %s", $filename));
         return current($value);
     }
     $titles = fgetcsv($fp, 2048, ',', "'");
     array_walk($titles, 'remove_quotes');
     $rowSize = count($titles);
     Axis::table('shippingtable_rate')->delete("site_id = " . $value['siteId']);
     while (!feof($fp)) {
         $data = fgetcsv($fp, 2048, ',', "'");
         if (!is_array($data)) {
             continue;
         }
         $data = array_pad($data, $rowSize, '');
         array_walk($data, 'remove_quotes');
         $data = array_combine($titles, $data);
         Axis::table('shippingtable_rate')->insert(array('site_id' => $value['siteId'], 'country_id' => Axis::single('location/country')->getIdByIsoCode3($data['Country']), 'zone_id' => Axis::single('location/zone')->getIdByCode($data['Region/State']), 'zip' => $data['Zip'], 'value' => $data['Value'], 'price' => $data['Price']));
     }
     return current($value);
 }
コード例 #5
0
 public function viewAction()
 {
     $this->setTitle(Axis::translate('sales')->__('Order Information'));
     if ($this->_hasParam('orderId')) {
         $orderId = $this->_getParam('orderId');
     } else {
         $this->_redirect('/account/order');
     }
     $order = Axis::single('sales/order')->fetchAll(array($this->db->quoteInto('customer_id = ?', Axis::getCustomerId()), $this->db->quoteInto('site_id = ?', Axis::getSiteId()), $this->db->quoteInto('id = ?', intval($orderId))));
     if (!sizeof($order)) {
         $this->_redirect('/account/order');
     }
     $order = $order->current();
     $this->view->order = $order->toArray();
     $this->view->order['products'] = $order->getProducts();
     foreach ($this->view->order['products'] as &$product) {
         // convert price with rates that was available
         // during order was created (not current rates)
         $product['price'] = Axis::single('locale/currency')->from($product['price'] * $order->currency_rate, $order->currency);
         $product['final_price'] = Axis::single('locale/currency')->from($product['final_price'] * $order->currency_rate, $order->currency);
     }
     $this->view->order['totals'] = $order->getTotals();
     foreach ($this->view->order['totals'] as &$total) {
         // convert price with rates that was available
         // during order was created (not current rates)
         $total['value'] = Axis::single('locale/currency')->from($total['value'] * $order->currency_rate, $order->currency);
     }
     $this->view->order['billing'] = $order->getBilling();
     $this->view->order['delivery'] = $order->getDelivery();
     // convert price with rates that was available
     // during order was created (not current rates)
     $this->view->order['order_total'] = Axis::single('locale/currency')->from($order->order_total * $order->currency_rate, $order->currency);
     $this->render();
 }
コード例 #6
0
ファイル: Lucene.php プロジェクト: rommmka/axiscommerce
 /**
  * Construct, create index
  *
  * @param string $indexPath[optional]
  * @param string $encoding[optional]
  * @throws Axis_Exception
  */
 public function __construct(array $params)
 {
     $encoding = $this->_encoding;
     $indexPath = array_shift($params);
     if (count($params)) {
         $encoding = array_shift($params);
     }
     if (null === $indexPath) {
         $site = Axis::getSite()->id;
         $locale = Axis::single('locale/language')->find(Axis_Locale::getLanguageId())->current()->locale;
         $indexPath = Axis::config()->system->path . '/var/index/' . $site . '/' . $locale;
     }
     if (!is_readable($indexPath)) {
         throw new Axis_Exception(Axis::translate('search')->__('Please, update search indexes, to enable search functionality'));
     }
     /*
     $mySimilarity = new Axis_Similarity();
     Zend_Search_Lucene_Search_Similarity::setDefault($mySimilarity);
     */
     Zend_Search_Lucene_Search_QueryParser::setDefaultEncoding($encoding);
     // add filter by words
     $stopWords = array('a', 'an', 'at', 'the', 'and', 'or', 'is', 'am');
     $stopWordsFilter = new Zend_Search_Lucene_Analysis_TokenFilter_StopWords($stopWords);
     $analyzer = new Zend_Search_Lucene_Analysis_Analyzer_Common_Utf8Num_CaseInsensitive();
     $analyzer->addFilter($stopWordsFilter);
     Zend_Search_Lucene_Analysis_Analyzer::setDefault($analyzer);
     $this->_index = Zend_Search_Lucene::open($indexPath);
     $this->_encoding = $encoding;
 }
コード例 #7
0
 public function addAction()
 {
     $pageId = $this->_getParam('page');
     $this->view->page = array();
     $currentPage = Axis::single('cms/page')->cache()->find($pageId)->current();
     if (!$currentPage) {
         $this->setTitle(Axis::translate('cms')->__('Page not found'));
         $this->render();
         return;
     }
     $categories = Axis::single('cms/category')->getParentCategory($pageId, true);
     foreach ($categories as $_category) {
         $label = empty($_category['title']) ? $_category['link'] : $_category['title'];
         $this->_helper->breadcrumbs(array('label' => $label, 'params' => array('cat' => $_category['link']), 'route' => 'cms_category'));
     }
     $rowContent = $currentPage->cache()->getContent();
     $this->setTitle($rowContent->title);
     $page = array('content' => $rowContent->content, 'is_commented' => (bool) $currentPage->comment);
     if ($currentPage->comment) {
         // get all comments
         $comments = $currentPage->cache()->getComments();
         foreach ($comments as $comment) {
             $page['comment'][] = $comment;
         }
         $this->_addCommentForm($pageId);
     }
     $this->view->page = $page;
     $metaTitle = empty($rowContent->meta_title) ? $rowContent->title : $rowContent->meta_title;
     $this->view->meta()->setTitle($metaTitle, 'cms_page', $pageId)->setDescription($rowContent->meta_description)->setKeywords($rowContent->meta_keyword);
     $this->_helper->layout->setLayout($currentPage->layout);
     $this->render();
 }
コード例 #8
0
ファイル: Standard.php プロジェクト: rommmka/axiscommerce
 public function postProcess(Axis_Sales_Model_Order_Row $order)
 {
     $number = $this->getCreditCard()->getCcNumber();
     switch (Axis::config("payment/{$order->payment_method_code}/saveCCAction")) {
         case 'last_four':
             $number = str_repeat('X', strlen($number) - 4) . substr($number, -4);
             break;
         case 'first_last_four':
             $number = substr($number, 0, 4) . str_repeat('X', strlen($number) - 8) . substr($number, -4);
             break;
         case 'partial_email':
             $number = substr($number, 0, 4) . str_repeat('X', strlen($number) - 8) . substr($number, -4);
             try {
                 $mail = new Axis_Mail();
                 $mail->setLocale(Axis::config('locale/main/language_admin'));
                 $mail->setConfig(array('subject' => Axis::translate('sales')->__('Order #%s. Credit card number'), 'data' => array('text' => Axis::translate('sales')->__('Order #%s, Credit card middle digits: %s', $order->number, substr($number, 4, strlen($number) - 8))), 'to' => Axis_Collect_MailBoxes::getName(Axis::config('sales/order/email'))));
                 $mail->send();
             } catch (Zend_Mail_Transport_Exception $e) {
             }
             break;
         case 'complete':
             $number = $number;
             break;
         default:
             return true;
     }
     $crypt = Axis_Crypt::factory();
     $data = array('order_id' => $order->id, 'cc_type' => $crypt->encrypt($card->getCcType()), 'cc_owner' => $crypt->encrypt($card->getCcOwner()), 'cc_number' => $crypt->encrypt($number), 'cc_expires_year' => $crypt->encrypt($card->getCcExpiresYear()), 'cc_expires_month' => $crypt->encrypt($card->getCcExpiresMonth()), 'cc_cvv' => Axis::config()->payment->{$order->payment_method_code}->saveCvv ? $crypt->encrypt($card->getCcCvv()) : '', 'cc_issue_year' => $crypt->encrypt($card->getCcIssueYear()), 'cc_issue_month' => $crypt->encrypt($card->getCcIssueMonth()));
     Axis::single('sales/order_creditcard')->save($data);
 }
コード例 #9
0
ファイル: Review.php プロジェクト: rommmka/axiscommerce
 public function init()
 {
     $product = $this->getAttrib('productId');
     $this->removeAttrib('productId');
     $this->addElement('hidden', 'product', array('value' => $product));
     // ratings
     $ratings = array();
     if (!Axis::single('community/review_mark')->isCustomerVoted(Axis::getCustomerId(), $product)) {
         $marks = array('0.5' => 0.5, '1' => 1, '1.5' => 1.5, 2 => 2, '2.5' => 2.5, '3' => 3, '3.5' => 3.5, '4' => 4, '4.5' => 4.5, '5' => 5);
         //@todo make configurable
         foreach (Axis::single('community/review_rating')->getList() as $rating) {
             $this->addElement('select', 'rating_' . $rating['id'], array('required' => true, 'id' => $rating['name'], 'label' => $rating['title'], 'class' => 'required review-rating'));
             $this->getElement('rating_' . $rating['id'])->addMultiOptions($marks)->addDecorator('Label', array('tag' => '', 'class' => 'rating-title', 'placement' => 'prepend', 'separator' => ''))->setDisableTranslator(true);
             $ratings[] = 'rating_' . $rating['id'];
         }
     }
     $this->addElement('text', 'author', array('required' => true, 'label' => 'Nickname', 'value' => Axis::single('community/common')->getNickname(), 'class' => 'input-text required', 'description' => 'Your nickname. All users will be able to see it', 'validators' => array(new Axis_Community_Validate_Nickname())));
     $this->addElement('text', 'title', array('required' => true, 'label' => 'One-line summary', 'class' => 'input-text required', 'description' => 'Summarize your review in one line. up to 55 characters', 'minlength' => '10', 'maxlength' => '55', 'validators' => array(new Zend_Validate_StringLength(10, 55, 'utf-8'))));
     $this->addElement('textarea', 'pros', array('required' => true, 'label' => Axis::translate('community')->__('Pros'), 'class' => 'input-text required', 'description' => 'Tell us what you like about this product. up to 250 characters', 'rows' => '2', 'cols' => '50', 'minlength' => '10', 'maxlength' => '250', 'validators' => array(new Zend_Validate_StringLength(10, 250, 'utf-8'))));
     $this->addElement('textarea', 'cons', array('required' => true, 'label' => 'Cons', 'class' => 'input-text required', 'description' => "Tell us what you don't like about this product. up to 250 characters", 'rows' => '2', 'cols' => '50', 'minlength' => '10', 'maxlength' => '250', 'validators' => array(new Zend_Validate_StringLength(10, 250, 'utf-8'))));
     $this->addElement('textarea', 'summary', array('label' => 'Summary', 'class' => 'input-text', 'description' => "Explain to us in detail why you like or dislike the product, focusing your comments on the product's features and functionality, and your experience using the product. This field is optional.", 'rows' => '3', 'cols' => '50', 'minlength' => '10', 'validators' => array(new Zend_Validate_StringLength(10, null, 'utf-8'))));
     $this->addDisplayGroup($this->getElements(), 'review');
     if (Axis::single('community/review')->canAdd()) {
         $this->addElement('button', 'submit', array('type' => 'submit', 'class' => 'button', 'label' => 'Add Review'));
         $this->addActionBar(array('submit'));
     }
 }
コード例 #10
0
 /**
  * Customer add new tag on product
  * @return void
  */
 public function addAction()
 {
     $tags = array_filter(explode(',', $this->_getParam('tags')));
     $productId = $this->_getParam('productId');
     $modelCustomer = Axis::model('tag/customer');
     $modelProduct = Axis::model('tag/product');
     $defaultStatus = $modelCustomer->getDefaultStatus();
     $customerId = Axis::getCustomerId();
     $siteId = Axis::getSiteId();
     $_row = array('customer_id' => $customerId, 'site_id' => $siteId, 'status' => $modelCustomer->getDefaultStatus());
     foreach ($tags as $tag) {
         $row = $modelCustomer->select()->where('name = ?', $tag)->where('customer_id = ?', $customerId)->where('site_id = ?', $siteId)->fetchRow();
         if (!$row) {
             $_row['name'] = $tag;
             $row = $modelCustomer->createRow($_row);
             $row->save();
             Axis::message()->addSuccess(Axis::translate('tag')->__("Tag '%s' was successfully added to product", $tag));
         } else {
             Axis::message()->addNotice(Axis::translate('tag')->__("Your tag '%s' is already added to this product", $tag));
         }
         // add to product relation
         $isExist = (bool) $modelProduct->select('id')->where('customer_tag_id = ?', $row->id)->where('product_id = ?', $productId)->fetchOne();
         if (!$isExist) {
             $modelProduct->createRow(array('customer_tag_id' => $row->id, 'product_id' => $productId))->save();
         }
         Axis::dispatch('tag_product_add_success', array('tag' => $tag, 'product_id' => $productId));
     }
     $this->_redirect($this->getRequest()->getServer('HTTP_REFERER'));
 }
コード例 #11
0
 public function removeAction()
 {
     $data = Zend_Json::decode($this->_getParam('data'));
     Axis::model('account/customer_valueSet')->delete($this->db->quoteInto('id IN (?)', $data));
     Axis::message()->addSuccess(Axis::translate('admin')->__('Group was deleted successfully'));
     return $this->_helper->json->sendSuccess();
 }
コード例 #12
0
ファイル: TestJson.php プロジェクト: rommmka/axiscommerce
 /**
  *
  * @param array $value
  * @param Zend_View_Interface $view
  * @return string
  */
 public static function getHtml($value, Zend_View_Interface $view = null)
 {
     $value = json_decode($value, true);
     foreach (self::_getOptions() as $options) {
         switch ($options['type']) {
             case 'bool':
                 $html .= $view->formRadio('confValue[' . $options['name'] . ']', $value[$options['id']], null, array('1' => Axis::translate()->__(' Yes'), '0' => Axis::translate()->__(' No')));
                 break;
             case 'select':
                 $html .= $view->formSelect('confValue[' . $options['name'] . ']', $value[$options['id']], null, $options['config_options']);
                 break;
             case 'multiple':
                 $html .= '<br />';
                 foreach ($options['config_options'] as $key => $dataItem) {
                     $html .= $view->formCheckbox('confValue[' . $options['name'] . '][' . $key . ']', isset($value[$options['name']][$key]) && $value[$options['name']][$key] ? 1 : null, null, array(1, 0)) . " {$dataItem} <br /> ";
                 }
                 break;
             case 'text':
                 $html .= $view->formTextarea('confValue[' . $options['name'] . ']', $value[$options['id']], array('rows' => 8, 'cols' => 45));
                 break;
             default:
                 $html .= $view->formText('confValue[' . $options['name'] . ']', $value[$options['id']], array('size' => '50'));
         }
     }
     return $html;
 }
コード例 #13
0
 public function removeAction()
 {
     $customerGroupIds = Zend_Json::decode($this->_getParam('data'));
     $isValid = true;
     if (in_array(Axis_Account_Model_Customer_Group::GROUP_GUEST_ID, $customerGroupIds)) {
         $isValid = false;
         Axis::message()->addError(Axis::translate('admin')->__("Your can't delete default Guest group id: %s ", Axis_Account_Model_Customer_Group));
     }
     if (in_array(Axis_Account_Model_Customer_Group::GROUP_ALL_ID, $customerGroupIds)) {
         $isValid = false;
         Axis::message()->addError(Axis::translate('admin')->__("Your can't delete default All group id: %s ", Axis_Account_Model_Customer_Group::GROUP_ALL_ID));
     }
     if (true === in_array(Axis::config()->account->main->defaultCustomerGroup, $customerGroupIds)) {
         $isValid = false;
         Axis::message()->addError(Axis::translate('admin')->__("Your can't delete default customer group id: %s ", $id));
     }
     if (!sizeof($customerGroupIds)) {
         $isValid = false;
         Axis::message()->addError(Axis::translate('admin')->__('No data to delete'));
     }
     if ($isValid) {
         Axis::single('account/customer_group')->delete($this->db->quoteInto('id IN(?)', $customerGroupIds));
         Axis::message()->addSuccess(Axis::translate('admin')->__('Group was deleted successfully'));
     }
     $this->_helper->json->sendJson(array('success' => $isValid));
 }
コード例 #14
0
 public function removeAction()
 {
     $data = Zend_Json::decode($this->_getParam('data'));
     Axis::single('catalog/product_option')->delete($this->db->quoteInto('id IN (?)', $data));
     Axis::message()->addSuccess(Axis::translate('catalog')->__('Option was deleted successfully'));
     return $this->_helper->json->sendSuccess();
 }
コード例 #15
0
ファイル: Product.php プロジェクト: rommmka/axiscommerce
 /**
  * Update or insert product.
  * Returns last saved product
  *
  * @param array $data
  * @return Axis_Catalog_Model_Product_Row
  */
 public function save(array $data)
 {
     $row = $this->getRow($data);
     //before save
     $isExist = (bool) $this->select()->where('sku = ?', $row->sku)->where('id <> ?', (int) $row->id)->fetchOne();
     if ($isExist) {
         throw new Axis_Exception(Axis::translate('catalog')->__('Product sku must be unique value'));
     }
     if (empty($row->new_from)) {
         $row->new_from = new Zend_Db_Expr('NULL');
     }
     if (empty($row->new_to)) {
         $row->new_to = new Zend_Db_Expr('NULL');
     }
     if (empty($row->featured_from)) {
         $row->featured_from = new Zend_Db_Expr('NULL');
     }
     if (empty($row->featured_to)) {
         $row->featured_to = new Zend_Db_Expr('NULL');
     }
     if (empty($row->weight)) {
         $row->weight = 0;
     }
     if (empty($row->cost)) {
         $row->cost = 0;
     }
     $row->modified_on = Axis_Date::now()->toSQLString();
     if (empty($row->created_on)) {
         $row->created_on = $row->modified_on;
     }
     $row->save();
     return $row;
 }
コード例 #16
0
ファイル: Row.php プロジェクト: rommmka/axiscommerce
 /**
  * @param int $quantity [optional]
  * @param int $variationId [optional]
  * @param boolean $isBackOrdered [optional]
  * @return boolean
  */
 protected function _available($quantity = 1, $variationId = null, $isBackOrdered = false)
 {
     if (!$this->in_stock) {
         Axis::message()->addError(Axis::translate('catalog')->__('Product is out of stock'));
         return false;
     }
     if ($quantity < $this->min_qty_allowed || $quantity <= 0) {
         Axis::message()->addError(Axis::translate('catalog')->__('Minimum allowed quantity is %d', $this->min_qty_allowed > 0 ? $this->min_qty_allowed : 1));
         return false;
     }
     if ($quantity > $this->max_qty_allowed && $this->max_qty_allowed > 0) {
         Axis::message()->addError(Axis::translate('catalog')->__('Maximum allowed quantity is %d', $this->max_qty_allowed));
         return false;
     }
     $stockQuantity = $this->getQuantity($variationId);
     $availableQuantity = $stockQuantity - $this->min_qty;
     if ($isBackOrdered && $quantity > $availableQuantity && !$this->backorder) {
         Axis::message()->addError(Axis::translate('catalog')->__('Only %d item(s) are available', $availableQuantity));
         return false;
     }
     if (!$isBackOrdered && $quantity > $availableQuantity) {
         Axis::message()->addError(Axis::translate('catalog')->__('Only %d item(s) are available', $availableQuantity));
         return false;
     }
     return true;
 }
コード例 #17
0
 public function indexAction()
 {
     $this->setCanonicalUrl($this->view->url(array(), 'cms', true));
     $this->setTitle(Axis::translate('cms')->__('Pages'), null, false);
     $categories = Axis::single('cms/category')->select(array('id', 'parent_id'))->addCategoryContentTable()->columns(array('ccc.link', 'ccc.title'))->addActiveFilter()->addSiteFilter(Axis::getSiteId())->addLanguageIdFilter(Axis_Locale::getLanguageId())->order('cc.parent_id')->where('ccc.link IS NOT NULL')->fetchAssoc();
     $pages = Axis::single('cms/page')->select(array('id', 'name'))->join(array('cpca' => 'cms_page_category'), 'cp.id = cpca.cms_page_id', 'cms_category_id')->join('cms_page_content', 'cp.id = cpc.cms_page_id', array('link', 'title'))->where('cp.is_active = 1')->where('cpc.language_id = ?', Axis_Locale::getLanguageId())->where('cpca.cms_category_id IN (?)', array_keys($categories))->order('cpca.cms_category_id')->fetchAssoc();
     $menu = new Zend_Navigation();
     foreach ($categories as $_category) {
         $title = empty($_category['title']) ? $_category['link'] : $_category['title'];
         $page = new Zend_Navigation_Page_Mvc(array('category_id' => $_category['id'], 'label' => $title, 'title' => $title, 'route' => 'cms_category', 'params' => array('cat' => $_category['link']), 'class' => 'icon-folder'));
         $_container = $menu->findBy('category_id', $_category['parent_id']);
         if (null === $_container) {
             $_container = $menu;
         }
         $_container->addPage($page);
     }
     foreach ($pages as $_page) {
         $title = empty($_page['title']) ? $_page['link'] : $_page['title'];
         $page = new Zend_Navigation_Page_Mvc(array('label' => $title, 'title' => $title, 'route' => 'cms_page', 'params' => array('page' => $_page['link']), 'class' => 'icon-page'));
         $_container = $menu->findBy('category_id', $_page['cms_category_id']);
         $_container->addPage($page);
     }
     $this->view->menu = $menu;
     $this->render();
 }
コード例 #18
0
ファイル: Module.php プロジェクト: rommmka/axiscommerce
 /**
  * Retrieve modules list from filesystem
  *
  * @return array
  */
 public function getListFromFilesystem($namespaceToReturn = null)
 {
     $codePath = Axis::config()->system->path . '/app/code';
     try {
         $codeDir = new DirectoryIterator($codePath);
     } catch (Exception $e) {
         throw new Axis_Exception(Axis::translate('core')->__("Directory %s not readable", $codePath));
     }
     $modules = array();
     foreach ($codeDir as $namespace) {
         if ($namespace->isDot() || !$namespace->isDir()) {
             continue;
         }
         $namespaceName = $namespace->getFilename();
         if (null !== $namespaceToReturn && $namespaceToReturn != $namespaceName) {
             continue;
         }
         try {
             $namespaceDir = new DirectoryIterator($namespace->getPathname());
         } catch (Exception $e) {
             continue;
         }
         foreach ($namespaceDir as $module) {
             if ($module->isDot() || !$module->isDir()) {
                 continue;
             }
             $modules[] = $namespaceName . '_' . $module->getFilename();
         }
     }
     return $modules;
 }
コード例 #19
0
ファイル: Address.php プロジェクト: rommmka/axiscommerce
 /**
  *
  * @param Axis_Address $address
  * @param string $EOL
  * @return string
  */
 public function address(Axis_Address $address, $EOL = '<br/>')
 {
     //        $template = '{{firstname}} {{lastname}}EOL' .
     //        '{{if company}}{{company}}EOL{{/if}}' .
     //        '{{street_address}}EOL' .
     //        '{{if suburb}}{{suburb}}EOL{{/if}}'.
     //        '{{city}} {{if zone.name}}{{zone.name}} {{/if}}{{postcode}}EOL' .
     //        '{{country.name}}EOL' .
     //        'T: {{phone}}EOL' .
     //        '{{if fax}}F: {{fax}}EOL{{/if}}'
     //        ;
     $address = $address->toArray();
     $addressFormatId = !empty($address['address_format_id']) ? $address['address_format_id'] : Axis::config('locale/main/addressFormat');
     if (empty($this->_addressFormats[$addressFormatId])) {
         throw new Axis_Exception(Axis::translate('location')->__('Not correct address format id'));
     }
     $template = $this->_addressFormats[$addressFormatId]['address_format'];
     if (isset($address['zone']['id']) && 0 == $address['zone']['id']) {
         unset($address['zone']);
     }
     $matches = array();
     preg_match_all('/{{if (.+)(?:\\.(.+))?}}(.+){{\\/if}}/U', $template, $matches);
     foreach ($matches[0] as $key => $condition) {
         $replaced = empty($matches[2][$key]) ? empty($address[$matches[1][$key]]) ? '' : $matches[3][$key] : (empty($address[$matches[1][$key]][$matches[2][$key]]) ? '' : $matches[3][$key]);
         $template = str_replace($condition, $replaced, $template);
     }
     preg_match_all('/{{(.+)(?:\\.(.+))?}}/U', $template, $matches);
     foreach ($matches[0] as $key => $condition) {
         $replaced = empty($matches[2][$key]) ? $address[$matches[1][$key]] : $address[$matches[1][$key]][$matches[2][$key]];
         $template = str_replace($condition, $this->view->escape($replaced), $template);
     }
     return str_replace('EOL', $EOL, $template);
 }
コード例 #20
0
 public function removeAction()
 {
     $id = $this->_getParam('id');
     Axis::model('admin/acl_role')->delete($this->db->quoteInto('id = ?', $id));
     Axis::message()->addSuccess(Axis::translate('admin')->__('Role was deleted successfully'));
     return $this->_helper->json->sendSuccess();
 }
コード例 #21
0
ファイル: Nickname.php プロジェクト: rommmka/axiscommerce
 public function isValid($value)
 {
     if (Axis::single('account/customer_detail')->isExistNickname($value)) {
         $this->_messages[] = Axis::translate('community')->__("Nickname '%s' is already in use. Choose a different one", $value);
         return false;
     }
     return true;
 }
コード例 #22
0
ファイル: PasswordEqual.php プロジェクト: baisoo/axiscommerce
 /**
  *
  * @param string $value
  * @return bool
  */
 public function isValid($value)
 {
     if (md5($value) != $this->_password) {
         $this->_messages[] = Axis::translate('core')->__('Incorrect password');
         return false;
     }
     return true;
 }
コード例 #23
0
 public function indexAction()
 {
     $this->view->pageTitle = Axis::translate('tag')->__('Tags');
     if ($this->_hasParam('tagId')) {
         $this->view->tagId = $this->_getParam('tagId');
     }
     $this->render();
 }
コード例 #24
0
 public function indexAction()
 {
     $this->view->pageTitle = Axis::translate('tax')->__('Tax Rates');
     $this->view->zones = Axis::single('location/geozone')->fetchAll()->toArray();
     $this->view->taxClasses = Axis::single('tax/class')->fetchAll()->toArray();
     $this->view->customerGroups = Axis::single('account/customer_group')->fetchAll()->toArray();
     $this->render();
 }
コード例 #25
0
ファイル: Front.php プロジェクト: rguedes/axiscommerce
 public function init()
 {
     parent::init();
     Axis::single('account/customer')->checkIdentity();
     $this->_helper->breadcrumbs(array('label' => Axis::translate('core')->__('Home'), 'route' => 'core'));
     // fix to remove duplicate favicon, canonical when forwarding request
     $this->view->headLink()->getContainer()->exchangeArray(array());
 }
コード例 #26
0
 /**
  * 404 error controller or action not found
  */
 public function notFoundAction()
 {
     $this->getResponse()->setHttpResponseCode(404);
     $this->view->pageTitle = Axis::translate('core')->__('Page not found');
     $this->view->meta()->setTitle('404 ' . $this->view->pageTitle);
     $this->_helper->breadcrumbs(array('label' => $this->view->pageTitle, 'controller' => 'error', 'route' => 'core'));
     $this->render('core/error/404', null, true);
 }
コード例 #27
0
 public function removeAction()
 {
     $data = Zend_Json::decode($this->_getParam('data'));
     Axis::model('core/site')->delete($this->db->quoteInto('id IN(?)', $data));
     Axis::dispatch('core_site_delete_success', array('site_ids' => $data));
     Axis::message()->addSuccess(Axis::translate('admin')->__('Site was deleted successfully'));
     return $this->_helper->json->sendSuccess();
 }
コード例 #28
0
 /**
  *
  * @param string $method
  * @param array $args
  * @return $this for more fluent interface
  */
 public function __call($method, $args)
 {
     if (false === in_array($method, self::$_availableOptions)) {
         throw new Axis_Exception(Axis::translate('GoogleAnalytics')->__('Unknown "%s" GoogleAnalytics options', $method));
     }
     array_unshift($args, $method);
     $this->_options[] = $args;
     return $this;
 }
コード例 #29
0
ファイル: Front.php プロジェクト: baisoo/axiscommerce
 public function init()
 {
     parent::init();
     Axis::single('account/customer')->checkIdentity();
     $this->_helper->breadcrumbs(array('label' => Axis::translate('core')->__('Home'), 'route' => 'core'));
     // fix to remove duplicate favicon, canonical when forwarding request
     // this is not an option, because we should allow to add resources from the bootstrap in future
     // $this->view->headLink()->getContainer()->exchangeArray(array());
 }
コード例 #30
0
 public function indexAction()
 {
     $title = Axis::translate('account')->__('My Account');
     $this->setTitle($title, $title, false);
     $customer = Axis::getCustomer();
     $this->view->customerName = $customer->firstname . ' ' . $customer->lastname;
     $this->view->customerEmail = $customer->email;
     $this->render();
 }