예제 #1
0
 /**
  * grid
  * create the configuration of the grid
  */
 public static function grid($rowNum = 10, $locale = null)
 {
     $translator = Shineisp_Registry::getInstance()->Zend_Translate;
     if ($locale === null) {
         $Session = new Zend_Session_Namespace('Admin');
         $locale = $Session->langid;
     }
     $config['datagrid']['columns'][] = array('label' => null, 'field' => 'pa.attribute_id', 'alias' => 'attribute_id', 'type' => 'selectall');
     $config['datagrid']['columns'][] = array('label' => $translator->translate('ID'), 'field' => 'pa.attribute_id', 'alias' => 'attribute_id', 'sortable' => true, 'searchable' => true, 'type' => 'string');
     $config['datagrid']['columns'][] = array('label' => $translator->translate('Code'), 'field' => 'code', 'alias' => 'code', 'sortable' => true, 'searchable' => true, 'type' => 'string');
     $config['datagrid']['columns'][] = array('label' => $translator->translate('Label'), 'field' => 'pad.label', 'alias' => 'label', 'sortable' => true, 'searchable' => true, 'type' => 'string');
     $config['datagrid']['columns'][] = array('label' => Isp::getPanel() . " " . $translator->translate('System Attributes'), 'field' => 'pa.system_var', 'alias' => 'system_var', 'sortable' => true, 'searchable' => true, 'type' => 'string');
     $config['datagrid']['columns'][] = array('label' => $translator->translate('Default'), 'field' => 'pa.defaultvalue', 'alias' => 'default', 'sortable' => true, 'searchable' => true, 'type' => 'string');
     $config['datagrid']['columns'][] = array('label' => $translator->translate('Position'), 'field' => 'pa.position', 'alias' => 'position', 'sortable' => true, 'searchable' => true, 'type' => 'index');
     $config['datagrid']['columns'][] = array('label' => $translator->translate('Visible on Frontend'), 'field' => 'pa.is_visible_on_front', 'alias' => 'visible', 'sortable' => true, 'searchable' => true, 'type' => 'boolean');
     $config['datagrid']['columns'][] = array('label' => $translator->translate('Groups'), 'type' => 'arraydata', 'index' => 'attribute_id', 'alias' => 'dummy', 'run' => array('ProductsAttributes' => 'getGroups'));
     $config['datagrid']['fields'] = "attribute_id, code, pad.label as label, pa.system_var as system_var, pa.is_visible_on_front as visible, pa.position as position, pa.defaultvalue as default";
     $config['datagrid']['dqrecordset'] = Doctrine_Query::create()->select($config['datagrid']['fields'])->from('ProductsAttributes pa')->leftJoin('pa.ProductsAttributesData pad WITH pad.language_id = ' . $locale);
     $config['datagrid']['rownum'] = $rowNum;
     $config['datagrid']['basepath'] = "/admin/productsattributes/";
     $config['datagrid']['index'] = "attribute_id";
     $config['datagrid']['rowlist'] = array('10', '50', '100', '1000');
     $config['datagrid']['buttons']['edit']['label'] = $translator->translate('Edit');
     $config['datagrid']['buttons']['edit']['cssicon'] = "edit";
     $config['datagrid']['buttons']['edit']['action'] = "/admin/productsattributes/edit/id/%d";
     $config['datagrid']['buttons']['delete']['label'] = $translator->translate('Delete');
     $config['datagrid']['buttons']['delete']['cssicon'] = "delete";
     $config['datagrid']['buttons']['delete']['action'] = "/admin/productsattributes/delete/id/%d";
     $config['datagrid']['massactions']['common'] = array('massdelete' => 'Mass Delete');
     return $config;
 }
예제 #2
0
 public function init()
 {
     // Set the custom decorator
     $this->addElementPrefixPath('Shineisp_Decorator', 'Shineisp/Decorator/', 'decorator');
     $translate = Shineisp_Registry::get('Zend_Translate');
     $this->addElement('text', 'code', array('filters' => array('StringTrim'), 'required' => true, 'label' => $translate->_('Attribute Code'), 'decorators' => array('Bootstrap'), 'class' => 'form-control'));
     $this->addElement('select', 'is_visible_on_front', array('decorators' => array('Bootstrap'), 'label' => $translate->_('Visible on Product page'), 'class' => 'form-control'));
     $this->getElement('is_visible_on_front')->setAllowEmpty(false)->setRegisterInArrayValidator(false)->setMultiOptions(array('0' => 'No', '1' => 'Yes'));
     $this->addElement('select', 'is_required', array('decorators' => array('Bootstrap'), 'label' => $translate->_('Is Required'), 'class' => 'form-control'));
     $this->getElement('is_required')->setAllowEmpty(false)->setRegisterInArrayValidator(false)->setMultiOptions(array('0' => 'No', '1' => 'Yes'));
     $this->addElement('select', 'is_comparable', array('decorators' => array('Bootstrap'), 'label' => $translate->_('Is Comparable'), 'class' => 'form-control'));
     $this->getElement('is_comparable')->setAllowEmpty(false)->setRegisterInArrayValidator(false)->setMultiOptions(array('0' => 'No', '1' => 'Yes'));
     $this->addElement('select', 'on_product_listing', array('decorators' => array('Bootstrap'), 'label' => $translate->_('Use on Product Listing'), 'class' => 'form-control'));
     $this->getElement('on_product_listing')->setAllowEmpty(false)->setRegisterInArrayValidator(false)->setMultiOptions(array('0' => 'No', '1' => 'Yes'));
     $this->addElement('select', 'active', array('decorators' => array('Bootstrap'), 'label' => $translate->_('Active'), 'class' => 'form-control'));
     $this->getElement('active')->setAllowEmpty(false)->setRegisterInArrayValidator(false)->setMultiOptions(array('0' => 'No', '1' => 'Yes'));
     $this->addElement('select', 'system', array('decorators' => array('Bootstrap'), 'label' => $translate->_('System'), 'class' => 'form-control'));
     $this->getElement('system')->setAllowEmpty(false)->setRegisterInArrayValidator(false)->setMultiOptions(array('0' => 'No', '1' => 'Yes'));
     $this->addElement('text', 'position', array('filters' => array('StringTrim'), 'label' => $translate->_('Position'), 'decorators' => array('Bootstrap'), 'class' => 'form-control'));
     $this->addElement('select', 'system_var', array('label' => $translate->_('System Variable'), 'decorators' => array('Bootstrap'), 'class' => 'form-control'));
     $this->getElement('system_var')->setAllowEmpty(false)->setRegisterInArrayValidator(false)->setMultiOptions(Panels::getOptionsXmlFields(Isp::getPanel()));
     $this->addElement('text', 'defaultvalue', array('filters' => array('StringTrim'), 'label' => $translate->_('Default Value'), 'description' => $translate->_('When the type of the object is a selectbox you have to use the Json code. eg: {"1": "True", "0": "False"}'), 'decorators' => array('Bootstrap'), 'class' => 'form-control'));
     $this->addElement('hidden', 'language_id', array('decorators' => array('Bootstrap')));
     $this->addElement('text', 'label', array('filters' => array('StringTrim'), 'label' => $translate->_('Label'), 'required' => true, 'decorators' => array('Bootstrap'), 'class' => 'form-control'));
     $this->addElement('text', 'description', array('filters' => array('StringTrim'), 'label' => $translate->_('Description'), 'decorators' => array('Bootstrap'), 'class' => 'form-control'));
     $this->addElement('text', 'prefix', array('filters' => array('StringTrim'), 'label' => $translate->_('Prefix'), 'decorators' => array('Bootstrap'), 'class' => 'form-control'));
     $this->addElement('text', 'suffix', array('filters' => array('StringTrim'), 'label' => $translate->_('Suffix'), 'decorators' => array('Bootstrap'), 'class' => 'form-control'));
     $this->addElement('select', 'type', array('filters' => array('StringTrim'), 'label' => $translate->_('Type'), 'description' => $translate->_('If the type is a dropdown selector you have to set the options using the Json structure in the default value textbox.'), 'required' => true, 'decorators' => array('Bootstrap'), 'class' => 'form-control'));
     $this->getElement('type')->setAllowEmpty(false)->setRegisterInArrayValidator(false)->setMultiOptions(array('text' => 'Textbox', 'select' => 'Dropdown Select', 'checkbox' => 'Checkbox'));
     $this->addElement('hidden', 'attribute_id');
 }
예제 #3
0
 /**
  * Get the setup configuration
  * 
  * 
  * @return ArrayObject
  */
 public static function getSetup($id)
 {
     $setup = "";
     $services = array();
     $panel = Isp::getPanel();
     $records = Doctrine_Query::create()->from('OrdersItems oi')->leftJoin('oi.Products p')->where('oi.detail_id = ?', $id)->execute(array(), Doctrine_Core::HYDRATE_ARRAY);
     foreach ($records as $record) {
         if (!empty($record['Products']['setup'])) {
             $setup = $record['Products']['setup'];
             // Get the parameters set in the order details (service)
             $params = json_decode($record['parameters'], true);
             if (is_array($params)) {
                 // Get the list of all the domains
                 $domains = OrdersItemsDomains::get_domains($record['detail_id']);
                 // We have to get the first domain
                 if (!empty($domains[0]['domain'])) {
                     $params['domain'] = $domains[0]['domain'];
                     // Get all the var {string} in the xml setup
                     preg_match_all('/{([^}]+)}/Ui', $setup, $matches);
                     foreach ($matches[1] as $parameter) {
                         $setup = str_replace("{" . $parameter . "}", $params[$parameter], $setup);
                     }
                 }
             }
         }
     }
     $xml = simplexml_load_string($setup);
     $arrSetup = Shineisp_Commons_Utilities::simpleXMLToArray($xml);
     return $arrSetup;
 }
예제 #4
0
파일: Panels.php 프로젝트: kokkez/shineisp
 /**
  * Get all the items set in the config.xml
  * for the activated ISP Panel
  * 
  * 
  * @param $panel
  * @see ProfileController
  * @return array options
  */
 public static function getOptionsXmlFields($panel)
 {
     $options = array();
     if (!empty($panel)) {
         $options[] = "";
         $panelattrs = self::getXmlFields(Isp::getPanel());
         foreach ($panelattrs as $attribute) {
             $options[$attribute['field']] = $attribute['field'];
         }
     }
     return $options;
 }
예제 #5
0
 /**
  * Execute the panel tasks
  */
 private function doPanelsTask(array $task)
 {
     $ISP = Isp::getByCustomerId($task['customer_id']);
     if (!$ISP || !isset($ISP['isp_id']) || !is_numeric($ISP['isp_id'])) {
         PanelsActions::UpdateTaskLog($task['action_id'], $this->translations->translate('isp_id not found'));
         $ISP = empty($ISP) ? Isp::getActiveISP() : $ISP;
         Shineisp_Commons_Utilities::SendEmail($ISP['email'], $ISP['email'], null, "Task error panel message", 'Customer ISP ID has been not set yet.');
         return false;
     }
     try {
         $customer_id = isset($task['customer_id']) ? $task['customer_id'] : 0;
         $ISPpanel = Isp::getPanel($ISP['isp_id']);
         $class = "Shineisp_Plugins_Panels_" . $ISPpanel . "_Main";
         Shineisp_Commons_Utilities::logs(__METHOD__ . ": Loading {$class} panel plugin");
         // Create the class registrar object
         $ISPclass = new $class();
         $action = $task['action'];
         Shineisp_Commons_Utilities::logs(__METHOD__ . ": Start {$action} action");
         if ($action == "createClient") {
             // Create the website plan
             $clientId = $ISPclass->create_client($task);
         } elseif ($action == "createWebsite") {
             // Create the website plan
             $websiteID = $ISPclass->create_website($task);
             // Create the main ftp account
             $ftpID = $ISPclass->create_ftp($task, $websiteID);
             // Send the configuration email
             $ISPclass->sendMail($task);
         } elseif ($action == "createMail") {
             // Create the email account
             $emailID = $ISPclass->create_mail($task);
             // Send the configuration email
             $ISPclass->sendMail($task);
         } elseif ($action == "createDatabase") {
             // Create the database
             $databaseID = $ISPclass->create_database($task);
             // Send the configuration email
             $ISPclass->sendMail($task);
         } elseif ($action == "fullProfile") {
             $websiteID = $ISPclass->create_website($task);
             // Create the website plan
             $ftpID = $ISPclass->create_ftp($task, $websiteID);
             // Create the main ftp account
             $emailID = $ISPclass->create_mail($task);
             // Create the email account
             $databaseID = $ISPclass->create_database($task);
             // Create the database
             // Send the configuration email
             $ISPclass->sendMail($task);
         }
         // Update the log description of the panel action
         PanelsActions::UpdateTaskLog($task['action_id'], $this->translations->translate("Your request has been executed."));
         // Update the status of the task
         PanelsActions::UpdateTaskStatus($task['action_id'], Statuses::id('complete', 'domains_tasks'));
         // Set the task as "Complete"
         Shineisp_Commons_Utilities::logs(__METHOD__ . ": End {$class} process");
     } catch (Exception $e) {
         PanelsActions::UpdateTaskLog($task['action_id'], $this->translations->translate($e->getMessage()));
         Shineisp_Commons_Utilities::SendEmail($ISP['email'], $ISP['email'], null, "Task error panel message", $e->getMessage());
         Shineisp_Commons_Utilities::logs(__METHOD__ . ": " . $e->getMessage());
     }
 }
 /**
  * editAction
  * Get a record and populate the application form 
  * @return unknown_type
  */
 public function editAction()
 {
     $Session = new Zend_Session_Namespace('Admin');
     $form = $this->getForm('/admin/productsattributes/process');
     // 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/productsattributes/list", "label" => $this->translator->translate('List'), "params" => array('css' => null, 'id' => 'submit')), array("url" => "/admin/productsattributes/new/", "label" => $this->translator->translate('New'), "params" => array('css' => null)));
     // Set the system field attribute title
     $panel = Isp::getPanel();
     if (!empty($panel)) {
         $form->getElement('system_var')->setLabel($panel);
     }
     $id = $this->getRequest()->getParam('id');
     if (!empty($id) && is_numeric($id)) {
         $rs = $this->productsattributes->getAllInfo($id, "*, pad.label as label, pad.prefix as prefix, pad.suffix as suffix, pad.description as description, pad.language_id as language_id", $Session->langid);
         if (!empty($rs)) {
             $this->view->id = $id;
             $rs['language_id'] = $Session->langid;
             // added to the form the language id selected
             $form->populate($rs);
         }
         $this->view->buttons[] = array("url" => "/admin/productsattributes/confirm/id/{$id}", "label" => $this->translator->translate('Delete'), "params" => array('css' => null));
     }
     $this->view->title = $this->translator->translate("Attribute Group");
     $this->view->description = $this->translator->translate("Here you can edit the attribute group details.");
     $this->view->form = $form;
     $this->render('applicantform');
 }