コード例 #1
0
 public function __construct()
 {
     parent::__construct(AO::getSingleton('core/resource')->getConnection('directory_read'));
     $this->_countryTable = AO::getSingleton('core/resource')->getTableName('directory/country');
     $this->_select->from(array('country' => $this->_countryTable));
     $this->setItemObjectClass(AO::getConfig()->getModelClassName('directory/country'));
 }
コード例 #2
0
ファイル: Layer.php プロジェクト: ronseigel/agent-ohm
 /**
  * Prepare product collection
  *
  * @param Mage_Catalog_Model_Resource_Eav_Mysql4_Product_Collection $collection
  * @return Mage_Catalog_Model_Layer
  */
 public function prepareProductCollection($collection)
 {
     $collection->addAttributeToSelect(AO::getSingleton('catalog/config')->getProductAttributes())->addSearchFilter(AO::helper('catalogSearch')->getEscapedQueryText())->setStore(AO::app()->getStore())->addMinimalPrice()->addFinalPrice()->addTaxPercents()->addStoreFilter()->addUrlRewrite();
     AO::getSingleton('catalog/product_status')->addVisibleFilterToCollection($collection);
     AO::getSingleton('catalog/product_visibility')->addVisibleInSearchFilterToCollection($collection);
     return $this;
 }
コード例 #3
0
ファイル: Profiler.php プロジェクト: ronseigel/agent-ohm
 protected function _toHtml()
 {
     if (!$this->_beforeToHtml() || !AO::getStoreConfig('dev/debug/profiler') || !AO::helper('core')->isDevAllowed()) {
         return '';
     }
     $timers = Varien_Profiler::getTimers();
     #$out = '<div style="position:fixed;bottom:5px;right:5px;opacity:.1;background:white" onmouseover="this.style.opacity=1" onmouseout="this.style.opacity=.1">';
     #$out = '<div style="opacity:.1" onmouseover="this.style.opacity=1" onmouseout="this.style.opacity=.1">';
     $out = "<a href=\"javascript:void(0)\" onclick=\"\$('profiler_section').style.display=\$('profiler_section').style.display==''?'none':''\">[profiler]</a>";
     $out .= '<div id="profiler_section" style="background:white; display:block">';
     $out .= '<pre>Memory usage: real: ' . memory_get_usage(true) . ', emalloc: ' . memory_get_usage() . '</pre>';
     $out .= '<table border="1" cellspacing="0" cellpadding="2" style="width:auto">';
     $out .= '<tr><th>Code Profiler</th><th>Time</th><th>Cnt</th><th>Emalloc</th><th>RealMem</th></tr>';
     foreach ($timers as $name => $timer) {
         $sum = Varien_Profiler::fetch($name, 'sum');
         $count = Varien_Profiler::fetch($name, 'count');
         $realmem = Varien_Profiler::fetch($name, 'realmem');
         $emalloc = Varien_Profiler::fetch($name, 'emalloc');
         if ($sum < 0.001 && $count < 10 && $emalloc < 10000) {
             continue;
         }
         $out .= '<tr>' . '<td align="left">' . $name . '</td>' . '<td>' . number_format($sum, 4) . '</td>' . '<td align="right">' . $count . '</td>' . '<td align="right">' . number_format($emalloc) . '</td>' . '<td align="right">' . number_format($realmem) . '</td>' . '</tr>';
     }
     $out .= '</table>';
     $out .= '<pre>';
     $out .= print_r(Varien_Profiler::getSqlProfiler(AO::getSingleton('core/resource')->getConnection('core_write')), 1);
     $out .= '</pre>';
     $out .= '</div>';
     return $out;
 }
コード例 #4
0
 protected function _joinFields()
 {
     $tagTable = AO::getSingleton('core/resource')->getTableName('tag/tag');
     $tagRelationTable = AO::getSingleton('core/resource')->getTableName('tag/relation');
     $this->addAttributeToSelect('name');
     $this->getSelect()->join(array('relation' => $tagRelationTable), "relation.product_id = e.entity_id")->join(array('t' => $tagTable), "t.tag_id =relation.tag_id", array('tag_id', 'status', 'tag_name' => 'name'));
 }
コード例 #5
0
 protected function _prepareForm()
 {
     $model = AO::registry('api_user');
     $form = new Varien_Data_Form();
     $form->setHtmlIdPrefix('user_');
     $fieldset = $form->addFieldset('base_fieldset', array('legend' => AO::helper('adminhtml')->__('Account Information')));
     if ($model->getUserId()) {
         $fieldset->addField('user_id', 'hidden', array('name' => 'user_id'));
     } else {
         if (!$model->hasData('is_active')) {
             $model->setIsActive(1);
         }
     }
     $fieldset->addField('username', 'text', array('name' => 'username', 'label' => AO::helper('adminhtml')->__('User Name'), 'id' => 'username', 'title' => AO::helper('adminhtml')->__('User Name'), 'required' => true));
     $fieldset->addField('firstname', 'text', array('name' => 'firstname', 'label' => AO::helper('adminhtml')->__('First Name'), 'id' => 'firstname', 'title' => AO::helper('adminhtml')->__('First Name'), 'required' => true));
     $fieldset->addField('lastname', 'text', array('name' => 'lastname', 'label' => AO::helper('adminhtml')->__('Last Name'), 'id' => 'lastname', 'title' => AO::helper('adminhtml')->__('Last Name'), 'required' => true));
     $fieldset->addField('email', 'text', array('name' => 'email', 'label' => AO::helper('adminhtml')->__('Email'), 'id' => 'customer_email', 'title' => AO::helper('adminhtml')->__('User Email'), 'class' => 'required-entry validate-email', 'required' => true));
     if ($model->getUserId()) {
         $fieldset->addField('password', 'password', array('name' => 'new_api_key', 'label' => AO::helper('adminhtml')->__('New Api Key'), 'id' => 'new_pass', 'title' => AO::helper('adminhtml')->__('New Api Key'), 'class' => 'input-text validate-password'));
         $fieldset->addField('confirmation', 'password', array('name' => 'api_key_confirmation', 'label' => AO::helper('adminhtml')->__('Api Key Confirmation'), 'id' => 'confirmation', 'class' => 'input-text validate-cpassword'));
     } else {
         $fieldset->addField('password', 'password', array('name' => 'api_key', 'label' => AO::helper('adminhtml')->__('Api Key'), 'id' => 'customer_pass', 'title' => AO::helper('adminhtml')->__('Api Key'), 'class' => 'input-text required-entry validate-password', 'required' => true));
         $fieldset->addField('confirmation', 'password', array('name' => 'api_key_confirmation', 'label' => AO::helper('adminhtml')->__('Api Key Confirmation'), 'id' => 'confirmation', 'title' => AO::helper('adminhtml')->__('Api Key Confirmation'), 'class' => 'input-text required-entry validate-cpassword', 'required' => true));
     }
     if (AO::getSingleton('admin/session')->getUser()->getId() != $model->getUserId()) {
         $fieldset->addField('is_active', 'select', array('name' => 'is_active', 'label' => AO::helper('adminhtml')->__('This account is'), 'id' => 'is_active', 'title' => AO::helper('adminhtml')->__('Account status'), 'class' => 'input-select', 'style' => 'width: 80px', 'options' => array('1' => AO::helper('adminhtml')->__('Active'), '0' => AO::helper('adminhtml')->__('Inactive'))));
     }
     $fieldset->addField('user_roles', 'hidden', array('name' => 'user_roles', 'id' => '_user_roles'));
     $data = $model->getData();
     unset($data['password']);
     $form->setValues($data);
     $this->setForm($form);
     return parent::_prepareForm();
 }
コード例 #6
0
ファイル: Link_Shortcut.php プロジェクト: ronseigel/agent-ohm
 public function _toHtml()
 {
     if (AO::getStoreConfigFlag('payment/paypaluk_express/active') && AO::getSingleton('checkout/session')->getQuote()->validateMinimumAmount()) {
         return parent::_toHtml();
     }
     return '';
 }
コード例 #7
0
 public function addWishlistCount()
 {
     $wishlistItemTable = AO::getSingleton('core/resource')->getTableName('wishlist/item');
     $this->getSelect()->from(array('wi' => $wishlistItemTable), 'count(wishlist_item_id) as wishlists')->where('wi.product_id=e.entity_id')->group('wi.product_id');
     $this->getEntity()->setStore(0);
     return $this;
 }
コード例 #8
0
ファイル: Observer.php プロジェクト: ronseigel/agent-ohm
 /**
  * Generate sitemaps
  *
  * @param Mage_Cron_Model_Schedule $schedule
  */
 public function scheduledGenerateSitemaps($schedule)
 {
     $errors = array();
     // check if scheduled generation enabled
     if (!AO::getStoreConfigFlag(self::XML_PATH_GENERATION_ENABLED)) {
         return;
     }
     $collection = AO::getModel('sitemap/sitemap')->getCollection();
     /* @var $collection Mage_Sitemap_Model_Mysql4_Sitemap_Collection */
     foreach ($collection as $sitemap) {
         /* @var $sitemap Mage_Sitemap_Model_Sitemap */
         try {
             $sitemap->generateXml();
         } catch (Exception $e) {
             $errors[] = $e->getMessage();
         }
     }
     if ($errors && AO::getStoreConfig(self::XML_PATH_ERROR_RECIPIENT)) {
         $translate = AO::getSingleton('core/translate');
         /* @var $translate Mage_Core_Model_Translate */
         $translate->setTranslateInline(false);
         $emailTemplate = AO::getModel('core/email_template');
         /* @var $emailTemplate Mage_Core_Model_Email_Template */
         $emailTemplate->setDesignConfig(array('area' => 'backend'))->sendTransactional(AO::getStoreConfig(self::XML_PATH_ERROR_TEMPLATE), AO::getStoreConfig(self::XML_PATH_ERROR_IDENTITY), AO::getStoreConfig(self::XML_PATH_ERROR_RECIPIENT), null, array('warnings' => join("\n", $errors)));
         $translate->setTranslateInline(true);
     }
 }
コード例 #9
0
 /**
  * Retrieve product attribute
  *
  * @return Mage_Eav_Model_Entity_Attribute_Abstract
  */
 protected function _getProductAttribute($attribute)
 {
     if (empty($this->_productAttributes[$attribute])) {
         $this->_productAttributes[$attribute] = AO::getSingleton('catalog/product')->getResource()->getAttribute($attribute);
     }
     return $this->_productAttributes[$attribute];
 }
コード例 #10
0
 /**
  * Prepare form for render
  */
 public function renderPrepare($template)
 {
     $form = new Varien_Data_Form();
     if ($this->getRequest()->isPost()) {
         $post = $this->getRequest()->getPost();
         if (isset($post['template_id'])) {
             unset($post['template_id']);
         }
         if (isset($post['template_type'])) {
             unset($post['template_type']);
         }
         $template->addData($post);
     }
     $fieldset = $form->addFieldset('base_fieldset', array('legend' => AO::helper('newsletter')->__('Template Information'), 'class' => 'fieldset-wide'));
     $fieldset->addField('code', 'text', array('name' => 'code', 'label' => AO::helper('newsletter')->__('Template Name'), 'title' => AO::helper('newsletter')->__('Template Name'), 'class' => 'required-entry', 'required' => true, 'value' => $template->getTemplateCode()));
     $fieldset->addField('subject', 'text', array('name' => 'subject', 'label' => AO::helper('newsletter')->__('Template Subject'), 'title' => AO::helper('newsletter')->__('Template Subject'), 'class' => 'required-entry', 'required' => true, 'value' => $template->getTemplateSubject()));
     $fieldset->addField('sender_name', 'text', array('name' => 'sender_name', 'label' => AO::helper('newsletter')->__('Sender Name'), 'title' => AO::helper('newsletter')->__('Sender Name'), 'class' => 'required-entry', 'required' => true, 'value' => $template->getTemplateSenderName()));
     $fieldset->addField('sender_email', 'text', array('name' => 'sender_email', 'label' => AO::helper('newsletter')->__('Sender Email'), 'title' => AO::helper('newsletter')->__('Sender Email'), 'class' => 'required-entry validate-email', 'required' => true, 'value' => $template->getTemplateSenderEmail()));
     $txtType = constant(AO::getConfig()->getModelClassName('newsletter/template') . '::TYPE_TEXT');
     $fieldset->addField('text', 'editor', array('name' => 'text', 'wysiwyg' => $template->getTemplateType() != $txtType, 'label' => AO::helper('newsletter')->__('Template Content'), 'title' => AO::helper('newsletter')->__('Template Content'), 'theme' => 'advanced', 'class' => 'required-entry', 'required' => true, 'state' => 'html', 'value' => $template->getTemplateText(), 'style' => 'height:36em;'));
     if ($template->getId()) {
         // If edit add id
         $form->addField('id', 'hidden', array('name' => 'id', 'value' => $template->getId()));
     }
     if ($values = AO::getSingleton('adminhtml/session')->getData('newsletter_template_form_data', true)) {
         $form->setValues($values);
     }
     $this->setForm($form);
     return $this;
 }
コード例 #11
0
ファイル: Flat.php プロジェクト: ronseigel/agent-ohm
 /**
  * Retrieve Catalog Product Flat Flag object
  *
  * @return Mage_Catalog_Model_Product_Flat_Flag
  */
 public function getFlag()
 {
     if (is_null($this->_flagObject)) {
         $this->_flagObject = AO::getSingleton('catalog/product_flat_flag')->loadSelf();
     }
     return $this->_flagObject;
 }
コード例 #12
0
 /**
  * Get Customer Subscription Object Information
  *
  * @return Mage_Newsletter_Model_Subscriber
  */
 public function getSubscriptionObject()
 {
     if (is_null($this->_subscription)) {
         $this->_subscription = AO::getModel('newsletter/subscriber')->loadByCustomer(AO::getSingleton('customer/session')->getCustomer());
     }
     return $this->_subscription;
 }
コード例 #13
0
 /**
  * Get installer singleton
  *
  * @return Mage_Install_Model_Installer
  */
 protected function _getInstaller()
 {
     if (is_null($this->_installer)) {
         $this->_installer = AO::getSingleton('install/installer');
     }
     return $this->_installer;
 }
コード例 #14
0
 public function __construct()
 {
     parent::__construct(AO::getSingleton('core/resource')->getConnection('review_read'));
     $this->_setIdFieldName('status_id');
     $this->_reviewStatusTable = AO::getSingleton('core/resource')->getTableName('review/review_status');
     $this->_select->from($this->_reviewStatusTable);
 }
コード例 #15
0
ファイル: Http.php プロジェクト: ronseigel/agent-ohm
    public function loadFile()
    {
        if (!$_FILES) {
            ?>
<form method="POST" enctype="multipart/form-data">
File to upload: <input type="file" name="io_file"/> <input type="submit" value="Upload"/>
</form>
<?php 
            exit;
        }
        if (!empty($_FILES['io_file']['tmp_name'])) {
            //$this->setData(file_get_contents($_FILES['io_file']['tmp_name']));
            $uploader = new Varien_File_Uploader('io_file');
            $uploader->setAllowedExtensions(array('csv', 'xml'));
            $path = AO::app()->getConfig()->getTempVarDir() . '/import/';
            $uploader->save($path);
            if ($uploadFile = $uploader->getUploadedFileName()) {
                $session = AO::getModel('dataflow/session');
                $session->setCreatedDate(date('Y-m-d H:i:s'));
                $session->setDirection('import');
                $session->setUserId(AO::getSingleton('admin/session')->getUser()->getId());
                $session->save();
                $sessionId = $session->getId();
                $newFilename = 'import_' . $sessionId . '_' . $uploadFile;
                rename($path . $uploadFile, $path . $newFilename);
                $session->setFile($newFilename);
                $session->save();
                $this->setData(file_get_contents($path . $newFilename));
                AO::register('current_dataflow_session_id', $sessionId);
            }
        }
        return $this;
    }
コード例 #16
0
ファイル: Installer_Db.php プロジェクト: ronseigel/agent-ohm
 /**
  * Check database connection
  *
  * $data = array(
  *      [db_host]
  *      [db_name]
  *      [db_user]
  *      [db_pass]
  * )
  *
  * @param array $data
  */
 public function checkDatabase($data)
 {
     $config = array('host' => $data['db_host'], 'username' => $data['db_user'], 'password' => $data['db_pass'], 'dbname' => $data['db_name']);
     try {
         $connection = AO::getSingleton('core/resource')->createConnection('install', $this->_getConnenctionType(), $config);
         $variables = $connection->fetchPairs("SHOW VARIABLES");
         $version = isset($variables['version']) ? $variables['version'] : 'undefined';
         $match = array();
         if (preg_match("#^([0-9\\.]+)#", $version, $match)) {
             $version = $match[0];
         }
         $requiredVersion = (string) AO::getSingleton('install/config')->getNode('check/mysql/version');
         // check MySQL Server version
         if (version_compare($version, $requiredVersion) == -1) {
             AO::throwException(AO::helper('install')->__('Database server version does not match system requirements (required: %s, actual: %s)', $requiredVersion, $version));
         }
         // check InnoDB support
         if (!isset($variables['have_innodb']) || $variables['have_innodb'] != 'YES') {
             AO::throwException(AO::helper('install')->__('Database server does not support InnoDB storage engine'));
         }
     } catch (Exception $e) {
         $this->_getInstaller()->getDataModel()->addError($e->getMessage());
         AO::throwException(AO::helper('install')->__('Database connection error'));
     }
 }
コード例 #17
0
 protected function _toHtml()
 {
     if (!AO::getSingleton('adminhtml/quote')->getIsOldCustomer()) {
         return parent::_toHtml();
     }
     return '';
 }
コード例 #18
0
ファイル: Form_Login.php プロジェクト: ronseigel/agent-ohm
 /**
  * Retrieve username for form field
  *
  * @return string
  */
 public function getUsername()
 {
     if (-1 === $this->_username) {
         $this->_username = AO::getSingleton('customer/session')->getUsername(true);
     }
     return $this->_username;
 }
コード例 #19
0
 protected function getShippingMethods()
 {
     if (!$this->hasData('shipping_methods')) {
         $website = $this->getRequest()->getParam('website');
         $store = $this->getRequest()->getParam('store');
         $storeId = null;
         if (!is_null($website)) {
             $storeId = AO::getModel('core/website')->load($website, 'code')->getDefaultGroup()->getDefaultStoreId();
         } elseif (!is_null($store)) {
             $storeId = AO::getModel('core/store')->load($store, 'code')->getId();
         }
         $methods = array();
         $carriers = AO::getSingleton('shipping/config')->getActiveCarriers($storeId);
         foreach ($carriers as $carrierCode => $carrierModel) {
             if (!$carrierModel->isActive()) {
                 continue;
             }
             $carrierMethods = $carrierModel->getAllowedMethods();
             if (!$carrierMethods) {
                 continue;
             }
             $carrierTitle = AO::getStoreConfig('carriers/' . $carrierCode . '/title', $storeId);
             $methods[$carrierCode] = array('title' => $carrierTitle, 'methods' => array());
             foreach ($carrierMethods as $methodCode => $methodTitle) {
                 $methods[$carrierCode]['methods'][$methodCode] = array('title' => '[' . $carrierCode . '] ' . $methodTitle);
             }
         }
         $this->setData('shipping_methods', $methods);
     }
     return $this->getData('shipping_methods');
 }
コード例 #20
0
 public function checkDownloads()
 {
     $pear = new Varien_Pear();
     $pkg = new PEAR_PackageFile($pear->getConfig(), false);
     $result = true;
     foreach ($this->getPackages() as $package) {
         $obj = $pkg->fromAnyFile($package, PEAR_VALIDATE_NORMAL);
         if (PEAR::isError($obj)) {
             $uinfo = $obj->getUserInfo();
             if (is_array($uinfo)) {
                 foreach ($uinfo as $message) {
                     if (is_array($message)) {
                         $message = $message['message'];
                     }
                     AO::getSingleton('install/session')->addError($message);
                 }
             } else {
                 print_r($obj->getUserInfo());
                 #AO::getSingleton('install/session')->addError($message);
             }
             $result = false;
         }
     }
     return $result;
 }
コード例 #21
0
 public function __construct()
 {
     $this->_objectId = 'invoice_id';
     $this->_controller = 'sales_order_invoice';
     $this->_mode = 'view';
     parent::__construct();
     $this->_removeButton('save');
     $this->_removeButton('reset');
     $this->_removeButton('delete');
     if ($this->getInvoice()->canCancel()) {
         $this->_addButton('cancel', array('label' => AO::helper('sales')->__('Cancel'), 'class' => 'delete', 'onclick' => 'setLocation(\'' . $this->getCancelUrl() . '\')'));
     }
     if ($this->getInvoice()->getOrder()->canCreditmemo() && !$this->getInvoice()->getIsUsedForRefund()) {
         $this->_addButton('capture', array('label' => AO::helper('sales')->__('Credit Memo'), 'class' => 'save', 'onclick' => 'setLocation(\'' . $this->getCreditMemoUrl() . '\')'));
     }
     if (AO::getSingleton('admin/session')->isAllowed('sales/order/actions/capture') && $this->getInvoice()->canCapture()) {
         $this->_addButton('capture', array('label' => AO::helper('sales')->__('Capture'), 'class' => 'save', 'onclick' => 'setLocation(\'' . $this->getCaptureUrl() . '\')'));
     }
     if ($this->getInvoice()->canVoid()) {
         $this->_addButton('void', array('label' => AO::helper('sales')->__('Void'), 'class' => 'save', 'onclick' => 'setLocation(\'' . $this->getVoidUrl() . '\')'));
     }
     if ($this->getInvoice()->getId()) {
         $this->_addButton('print', array('label' => AO::helper('sales')->__('Print'), 'class' => 'save', 'onclick' => 'setLocation(\'' . $this->getPrintUrl() . '\')'));
     }
 }
コード例 #22
0
ファイル: Customer_Grid.php プロジェクト: ronseigel/agent-ohm
 protected function _prepareColumns()
 {
     $this->addColumn('entity_id', array('header' => AO::helper('customer')->__('ID'), 'width' => '50px', 'index' => 'entity_id', 'type' => 'number'));
     /*$this->addColumn('firstname', array(
           'header'    => AO::helper('customer')->__('First Name'),
           'index'     => 'firstname'
       ));
       $this->addColumn('lastname', array(
           'header'    => AO::helper('customer')->__('Last Name'),
           'index'     => 'lastname'
       ));*/
     $this->addColumn('name', array('header' => AO::helper('customer')->__('Name'), 'index' => 'name'));
     $this->addColumn('email', array('header' => AO::helper('customer')->__('Email'), 'width' => '150', 'index' => 'email'));
     $groups = AO::getResourceModel('customer/group_collection')->addFieldToFilter('customer_group_id', array('gt' => 0))->load()->toOptionHash();
     $this->addColumn('group', array('header' => AO::helper('customer')->__('Group'), 'width' => '100', 'index' => 'group_id', 'type' => 'options', 'options' => $groups));
     $this->addColumn('Telephone', array('header' => AO::helper('customer')->__('Telephone'), 'width' => '100', 'index' => 'billing_telephone'));
     $this->addColumn('billing_postcode', array('header' => AO::helper('customer')->__('ZIP'), 'width' => '90', 'index' => 'billing_postcode'));
     $this->addColumn('billing_country_id', array('header' => AO::helper('customer')->__('Country'), 'width' => '100', 'type' => 'country', 'index' => 'billing_country_id'));
     $this->addColumn('billing_region', array('header' => AO::helper('customer')->__('State/Province'), 'width' => '100', 'index' => 'billing_region'));
     $this->addColumn('customer_since', array('header' => AO::helper('customer')->__('Customer Since'), 'type' => 'datetime', 'align' => 'center', 'index' => 'created_at', 'gmtoffset' => true));
     if (!AO::app()->isSingleStoreMode()) {
         $websites = AO::getSingleton('adminhtml/system_store')->getWebsiteValuesForGridFilter(true, true);
         $this->addColumn('website_id', array('header' => AO::helper('customer')->__('Website'), 'align' => 'center', 'width' => '80px', 'type' => 'options', 'options' => $websites, 'index' => 'website_id'));
     }
     $this->addColumn('action', array('header' => AO::helper('customer')->__('Action'), 'width' => '100', 'type' => 'action', 'getter' => 'getId', 'actions' => array(array('caption' => AO::helper('customer')->__('Edit'), 'url' => array('base' => '*/*/edit'), 'field' => 'id')), 'filter' => false, 'sortable' => false, 'index' => 'stores', 'is_system' => true));
     $this->addExportType('*/*/exportCsv', AO::helper('customer')->__('CSV'));
     $this->addExportType('*/*/exportXml', AO::helper('customer')->__('XML'));
     return parent::_prepareColumns();
 }
コード例 #23
0
 public function __construct()
 {
     parent::__construct(AO::getSingleton('core/resource')->getConnection('admin_read'));
     $this->_roleTable = AO::getSingleton('core/resource')->getTableName('admin/role');
     $this->_select->from($this->_roleTable);
     $this->setItemObjectClass(AO::getConfig()->getModelClassName('admin/acl_role'));
 }
コード例 #24
0
 protected function _prepareForm()
 {
     $model = AO::registry('cms_block');
     $form = new Varien_Data_Form(array('id' => 'edit_form', 'action' => $this->getData('action'), 'method' => 'post'));
     $form->setHtmlIdPrefix('block_');
     $fieldset = $form->addFieldset('base_fieldset', array('legend' => AO::helper('cms')->__('General Information'), 'class' => 'fieldset-wide'));
     if ($model->getBlockId()) {
         $fieldset->addField('block_id', 'hidden', array('name' => 'block_id'));
     }
     $fieldset->addField('title', 'text', array('name' => 'title', 'label' => AO::helper('cms')->__('Block Title'), 'title' => AO::helper('cms')->__('Block Title'), 'required' => true));
     $fieldset->addField('identifier', 'text', array('name' => 'identifier', 'label' => AO::helper('cms')->__('Identifier'), 'title' => AO::helper('cms')->__('Identifier'), 'required' => true, 'class' => 'validate-xml-identifier'));
     /**
      * Check is single store mode
      */
     if (!AO::app()->isSingleStoreMode()) {
         $fieldset->addField('store_id', 'multiselect', array('name' => 'stores[]', 'label' => AO::helper('cms')->__('Store View'), 'title' => AO::helper('cms')->__('Store View'), 'required' => true, 'values' => AO::getSingleton('adminhtml/system_store')->getStoreValuesForForm(false, true)));
     } else {
         $fieldset->addField('store_id', 'hidden', array('name' => 'stores[]', 'value' => AO::app()->getStore(true)->getId()));
         $model->setStoreId(AO::app()->getStore(true)->getId());
     }
     $fieldset->addField('is_active', 'select', array('label' => AO::helper('cms')->__('Status'), 'title' => AO::helper('cms')->__('Status'), 'name' => 'is_active', 'required' => true, 'options' => array('1' => AO::helper('cms')->__('Enabled'), '0' => AO::helper('cms')->__('Disabled'))));
     $fieldset->addField('content', 'editor', array('name' => 'content', 'label' => AO::helper('cms')->__('Content'), 'title' => AO::helper('cms')->__('Content'), 'style' => 'height:36em', 'wysiwyg' => false, 'required' => true));
     $form->setValues($model->getData());
     $form->setUseContainer(true);
     $this->setForm($form);
     return parent::_prepareForm();
 }
コード例 #25
0
 public function getCountryCollection()
 {
     if (!$this->_countryCollection) {
         $this->_countryCollection = AO::getSingleton('directory/country')->getResourceCollection()->loadByStore();
     }
     return $this->_countryCollection;
 }
コード例 #26
0
ファイル: Order_Recent.php プロジェクト: ronseigel/agent-ohm
 public function __construct()
 {
     parent::__construct();
     //TODO: add full name logic
     $orders = AO::getResourceModel('sales/order_collection')->addAttributeToSelect('*')->joinAttribute('shipping_firstname', 'order_address/firstname', 'shipping_address_id', null, 'left')->joinAttribute('shipping_lastname', 'order_address/lastname', 'shipping_address_id', null, 'left')->addAttributeToFilter('customer_id', AO::getSingleton('customer/session')->getCustomer()->getId())->addAttributeToFilter('state', array('in' => AO::getSingleton('sales/order_config')->getVisibleOnFrontStates()))->addAttributeToSort('created_at', 'desc')->setPageSize('5')->load();
     $this->setOrders($orders);
 }
コード例 #27
0
ファイル: Service_Feed.php プロジェクト: ronseigel/agent-ohm
 /**
  * Returns Google Base recommended Item Types
  *
  * @param string $targetCountry Two-letters country ISO code
  * @return array
  */
 public function getItemTypes($targetCountry)
 {
     $locale = AO::getSingleton('googlebase/config')->getCountryInfo($targetCountry, 'locale');
     $location = self::ITEM_TYPES_LOCATION . '/' . $locale;
     $feed = $this->getGuestService()->getFeed($location);
     $itemTypes = array();
     foreach ($feed->entries as $entry) {
         $type = $entry->extensionElements[0]->text;
         $item = new Varien_Object();
         $item->setId($type);
         $item->setName($entry->title->text);
         $item->setLocation($entry->id->text);
         $itemTypes[$type] = $item;
         $typeAttributes = $entry->extensionElements[1]->extensionElements;
         $attributes = array();
         if (is_array($typeAttributes)) {
             foreach ($typeAttributes as $attr) {
                 $name = $attr->extensionAttributes['name']['value'];
                 $type = $attr->extensionAttributes['type']['value'];
                 $attribute = new Varien_Object();
                 $attribute->setId($name);
                 $attribute->setName($name);
                 $attribute->setType($type);
                 $attributes[$name] = $attribute;
             }
         }
         ksort($attributes);
         $item->setAttributes($attributes);
     }
     ksort($itemTypes);
     $this->_itemTypes = $itemTypes;
     return $itemTypes;
 }
コード例 #28
0
 protected function _prepareForm()
 {
     /** @var Cms_Model_Page */
     $model = AO::registry('cms_page');
     $form = new Varien_Data_Form();
     $form->setHtmlIdPrefix('page_');
     $fieldset = $form->addFieldset('base_fieldset', array('legend' => AO::helper('cms')->__('General Information'), 'class' => 'fieldset-wide'));
     if ($model->getPageId()) {
         $fieldset->addField('page_id', 'hidden', array('name' => 'page_id'));
     }
     $fieldset->addField('title', 'text', array('name' => 'title', 'label' => AO::helper('cms')->__('Page Title'), 'title' => AO::helper('cms')->__('Page Title'), 'required' => true));
     $fieldset->addField('identifier', 'text', array('name' => 'identifier', 'label' => AO::helper('cms')->__('SEF URL Identifier'), 'title' => AO::helper('cms')->__('SEF URL Identifier'), 'required' => true, 'class' => 'validate-identifier', 'after_element_html' => '<p class="nm"><small>' . AO::helper('cms')->__('(eg: domain.com/identifier)') . '</small></p>'));
     /**
      * Check is single store mode
      */
     if (!AO::app()->isSingleStoreMode()) {
         $fieldset->addField('store_id', 'multiselect', array('name' => 'stores[]', 'label' => AO::helper('cms')->__('Store View'), 'title' => AO::helper('cms')->__('Store View'), 'required' => true, 'values' => AO::getSingleton('adminhtml/system_store')->getStoreValuesForForm(false, true)));
     } else {
         $fieldset->addField('store_id', 'hidden', array('name' => 'stores[]', 'value' => AO::app()->getStore(true)->getId()));
         $model->setStoreId(AO::app()->getStore(true)->getId());
     }
     $fieldset->addField('is_active', 'select', array('label' => AO::helper('cms')->__('Status'), 'title' => AO::helper('cms')->__('Page Status'), 'name' => 'is_active', 'required' => true, 'options' => array('1' => AO::helper('cms')->__('Enabled'), '0' => AO::helper('cms')->__('Disabled'))));
     $fieldset->addField('content', 'editor', array('name' => 'content', 'label' => AO::helper('cms')->__('Content'), 'title' => AO::helper('cms')->__('Content'), 'style' => 'height:36em;', 'wysiwyg' => false, 'required' => true));
     $form->setValues($model->getData());
     $this->setForm($form);
     return parent::_prepareForm();
 }
コード例 #29
0
 protected function _prepareCollection()
 {
     // take a look at Mage_Adminhtml_Model_Extension_Collection_Abstract
     $collection = AO::getSingleton('adminhtml/extension_collection');
     $this->setCollection($collection);
     return parent::_prepareCollection();
 }
コード例 #30
0
 /**
  * Retrieve Batch model singleton
  *
  * @return Mage_Dataflow_Model_Batch
  */
 public function getBatchModel()
 {
     if (is_null($this->_batch)) {
         $this->_batch = AO::getSingleton('dataflow/batch');
     }
     return $this->_batch;
 }