public function init() { // Set the custom decorator $this->addElementPrefixPath('Shineisp_Decorator', 'Shineisp/Decorator/', 'decorator'); $translate = Shineisp_Registry::get('Zend_Translate'); $this->addElement('text', 'company', array('filters' => array('StringTrim'), 'required' => true, 'label' => $translate->_('Company'), 'decorators' => array('Bootstrap'), 'class' => 'form-control')); $this->addElement('text', 'vatnumber', array('filters' => array('StringTrim'), 'required' => true, 'label' => $translate->_('VAT Number'), 'decorators' => array('Bootstrap'), 'class' => 'form-control')); $this->addElement('text', 'address', array('filters' => array('StringTrim'), 'required' => true, 'label' => $translate->_('Address'), 'decorators' => array('Bootstrap'), 'class' => 'form-control')); $this->addElement('text', 'zip', array('filters' => array('StringTrim'), 'required' => true, 'label' => $translate->_('ZIP Code'), 'decorators' => array('Bootstrap'), 'class' => 'form-control')); $this->addElement('text', 'city', array('filters' => array('StringTrim'), 'required' => true, 'label' => $translate->_('City'), 'decorators' => array('Bootstrap'), 'class' => 'form-control')); $this->addElement('text', 'country', array('filters' => array('StringTrim'), 'required' => true, 'label' => $translate->_('Country'), 'decorators' => array('Bootstrap'), 'class' => 'form-control')); $this->addElement('text', 'telephone', array('filters' => array('StringTrim'), 'required' => true, 'label' => $translate->_('Telephone'), 'decorators' => array('Bootstrap'), 'class' => 'form-control')); $this->addElement('text', 'fax', array('filters' => array('StringTrim'), 'required' => true, 'label' => $translate->_('Fax'), 'decorators' => array('Bootstrap'), 'class' => 'form-control')); $this->addElement('text', 'bankname', array('filters' => array('StringTrim'), 'label' => $translate->_('Bank name'), 'decorators' => array('Bootstrap'), 'class' => 'form-control')); $this->addElement('text', 'iban', array('filters' => array('StringTrim'), 'label' => $translate->_('IBAN'), 'decorators' => array('Bootstrap'), 'class' => 'form-control')); $this->addElement('text', 'bic', array('filters' => array('StringTrim'), 'label' => $translate->_('BIC'), 'decorators' => array('Bootstrap'), 'class' => 'form-control')); $this->addElement('text', 'slogan', array('filters' => array('StringTrim'), 'required' => true, 'label' => $translate->_('Slogan'), 'decorators' => array('Bootstrap'), 'class' => 'form-control')); $this->addElement('text', 'manager', array('filters' => array('StringTrim'), 'required' => true, 'label' => $translate->_('Manager'), 'decorators' => array('Bootstrap'), 'class' => 'form-control')); $this->addElement('text', 'custom1', array('filters' => array('StringTrim'), 'label' => $translate->_('Custom 1'), 'decorators' => array('Bootstrap'), 'class' => 'form-control')); $this->addElement('text', 'custom2', array('filters' => array('StringTrim'), 'label' => $translate->_('Custom 2'), 'decorators' => array('Bootstrap'), 'class' => 'form-control')); $this->addElement('text', 'custom3', array('filters' => array('StringTrim'), 'label' => $translate->_('Custom 3'), 'decorators' => array('Bootstrap'), 'class' => 'form-control')); $this->addElement('text', 'website', array('filters' => array('StringTrim'), 'required' => true, 'label' => $translate->_('Website'), 'decorators' => array('Bootstrap'), 'class' => 'form-control')); $this->addElement('text', 'email', array('filters' => array('StringTrim', 'StringToLower'), 'decorators' => array('Bootstrap'), 'validators' => array('EmailAddress'), 'required' => true, 'label' => $translate->_('Email'), 'class' => 'form-control')); $this->addElement('file', 'logo', array('label' => $translate->_('Logo'))); $this->addElement('file', 'logo_email', array('label' => $translate->_('Logo Email'))); $this->addElement('password', 'password', array('filters' => array('StringTrim'), 'decorators' => array('Bootstrap'), 'validators' => array(array('regex', false, '/^[a-zA-Z0-9\\-\\_\\.\\%\\!\\$]{6,20}$/')), 'label' => $translate->_('Password'), 'class' => 'form-control')); $this->addElement('select', 'isppanel', array('filters' => array('StringTrim'), 'label' => $translate->_('ISP Panel'), 'decorators' => array('Bootstrap'), 'class' => 'form-control')); $this->getElement('isppanel')->setAllowEmpty(false)->setMultiOptions(Panels::getPanelInstalled()); $this->addElement('hidden', 'isp_id'); }
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'); }
public function init() { // Set the custom decorator $this->addElementPrefixPath('Shineisp_Decorator', 'Shineisp/Decorator/', 'decorator'); $translate = Shineisp_Registry::get('Zend_Translate'); $this->addElement('select', 'isp_id', array('label' => $translate->_('Isp'), 'decorators' => array('Bootstrap'), 'class' => 'form-control')); $this->getElement('isp_id')->setAllowEmpty(false)->setMultiOptions(Isp::getList())->setRequired(true); $this->addElement('select', 'type_id', array('label' => $translate->_('Server Type'), 'decorators' => array('Bootstrap'), 'class' => 'form-control')); $this->getElement('type_id')->setAllowEmpty(false)->setMultiOptions(Servers_Types::getList())->setRequired(true); $this->addElement('select', 'status_id', array('label' => $translate->_('Status'), 'decorators' => array('Bootstrap'), 'class' => 'form-control')); $this->getElement('status_id')->setAllowEmpty(false)->setMultiOptions(Statuses::getList('servers'))->setRequired(true); $this->addElement('text', 'name', array('filters' => array('StringTrim'), 'required' => true, 'label' => $translate->_('Server Name'), 'decorators' => array('Bootstrap'), 'class' => 'form-control')); $this->addElement('text', 'ip', array('filters' => array('StringTrim'), 'required' => true, 'label' => $translate->_('IP'), 'decorators' => array('Bootstrap'), 'class' => 'form-control')); $this->addElement('text', 'netmask', array('filters' => array('StringTrim'), 'required' => true, 'label' => $translate->_('Netmask'), 'decorators' => array('Bootstrap'), 'class' => 'form-control')); $this->addElement('text', 'host', array('filters' => array('StringTrim'), 'required' => true, 'label' => $translate->_('Host'), 'decorators' => array('Bootstrap'), 'class' => 'form-control')); $this->addElement('text', 'domain', array('filters' => array('StringTrim'), 'required' => true, 'label' => $translate->_('Domain'), 'decorators' => array('Bootstrap'), 'class' => 'form-control')); $this->addElement('textarea', 'description', array('required' => true, 'label' => $translate->_('Description'), 'decorators' => array('Bootstrap'), 'class' => 'col-lg-12 form-control')); $this->addElement('select', 'panel_id', array('filters' => array('StringTrim'), 'label' => $translate->_('Control Panel'), 'decorators' => array('Bootstrap'), 'class' => 'form-control')); $this->getElement('panel_id')->setAllowEmpty(false)->setMultiOptions(Panels::getListInstalled(true)); $this->addElement('text', 'datacenter', array('filters' => array('StringTrim'), 'required' => false, 'label' => $translate->_('Datacenter'), 'decorators' => array('Bootstrap'), 'class' => 'form-control')); $this->addElement('text', 'cost', array('filters' => array('StringTrim'), 'required' => true, 'label' => $translate->_('Server cost'), 'decorators' => array('Bootstrap'), 'class' => 'form-control')); $this->addElement('text', 'max_accounts', array('filters' => array('StringTrim'), 'required' => false, 'label' => $translate->_('Max accounts'), 'decorators' => array('Bootstrap'), 'class' => 'form-control')); $this->addElement('text', 'buy_date', array('filters' => array('StringTrim'), 'label' => $translate->_('Buy Date'), 'description' => $translate->_('Purchase date of this server'), 'decorators' => array('Bootstrap'), 'class' => 'form-control date')); $this->addElement('checkbox', 'is_default', array('filters' => array('StringTrim'), 'required' => false, 'label' => $translate->_('Default server'), 'description' => $translate->_('Default server for the group'), 'decorators' => array('Bootstrap'), 'class' => 'form-control')); $this->addElement('hidden', 'server_id'); }
public function init() { // Set the custom decorator $this->addElementPrefixPath('Shineisp_Decorator', 'Shineisp/Decorator/', 'decorator'); $translate = Shineisp_Registry::get('Zend_Translate'); $this->addElement('text', 'action', array('filters' => array('StringTrim'), 'required' => true, 'decorators' => array('Bootstrap'), 'label' => $translate->_('Action'), 'class' => 'form-control')); $this->addElement('text', 'start', array('filters' => array('StringTrim'), 'required' => true, 'decorators' => array('Bootstrap'), 'label' => $translate->_('Start Date'), 'class' => 'form-control date')); $this->addElement('text', 'end', array('filters' => array('StringTrim'), 'decorators' => array('Bootstrap'), 'label' => $translate->_('End Date'), 'class' => 'form-control date')); $this->addElement('textarea', 'log', array('filters' => array('StringTrim'), 'decorators' => array('Bootstrap'), 'label' => $translate->_('Log'), 'class' => 'form-control')); $this->addElement('textarea', 'parameters', array('filters' => array('StringTrim'), 'decorators' => array('Bootstrap'), 'label' => $translate->_('Parameters'), 'description' => $translate->_('Json encoded attribute parameters'), 'rows' => '5', 'class' => 'form-control')); $this->addElement('select', 'panel_id', array('filters' => array('StringTrim'), 'decorators' => array('Bootstrap'), 'label' => $translate->_('Panel'), 'class' => 'form-control')); $this->getElement('panel_id')->setAllowEmpty(false)->setRegisterInArrayValidator(false)->setMultiOptions(Panels::getList()); $this->addElement('select', 'status_id', array('filters' => array('StringTrim'), 'decorators' => array('Bootstrap'), 'label' => $translate->_('Status'), 'class' => 'form-control')); $this->getElement('status_id')->setAllowEmpty(false)->setRegisterInArrayValidator(false)->setMultiOptions(Statuses::getList('domains')); $this->addElement('hidden', 'action_id'); }
/** * grid * create the configuration of the grid */ public static function grid($rowNum = 10) { $ns = new Zend_Session_Namespace(); $translator = Shineisp_Registry::getInstance()->Zend_Translate; $config['datagrid']['columns'][] = array('label' => null, 'field' => 'd.detail_id', 'alias' => 'id', 'type' => 'selectall'); $config['datagrid']['columns'][] = array('label' => $translator->translate('ID'), 'field' => 'd.detail_id', 'alias' => 'id', 'sortable' => true, 'searchable' => true, 'type' => 'string'); $config['datagrid']['columns'][] = array('label' => $translator->translate('Order ID'), 'field' => 'o.order_id', 'alias' => 'order_id', 'sortable' => true, 'searchable' => true, 'type' => 'string', 'attributes' => array('class' => 'visible-lg visible-md hidden-xs')); $config['datagrid']['columns'][] = array('label' => $translator->translate('Type'), 'field' => 'p.type', 'alias' => 'type', 'sortable' => true, 'searchable' => true, 'type' => 'string'); $config['datagrid']['columns'][] = array('label' => $translator->translate('Service'), 'field' => 'pd.name', 'alias' => 'productname', 'sortable' => true, 'searchable' => true, 'type' => 'link', 'link' => array('idx' => 'product_id', 'href' => '/admin/products/edit/id/%s')); $config['datagrid']['columns'][] = array('label' => $translator->translate('Domain'), 'field' => 'dm.domain', 'alias' => 'domain', 'sortable' => true, 'searchable' => true, 'type' => 'string', 'attributes' => array('class' => 'visible-lg visible-md hidden-xs')); $config['datagrid']['columns'][] = array('label' => $translator->translate('Company'), 'field' => 'c.company', 'alias' => 'company', 'sortable' => true, 'searchable' => true, 'type' => 'link', 'link' => array('idx' => 'customer_id', 'href' => '/admin/customers/edit/id/%s'), 'attributes' => array('class' => 'visible-lg visible-md hidden-xs')); $config['datagrid']['columns'][] = array('label' => $translator->translate('Last name'), 'field' => 'c.lastname', 'alias' => 'lastname', 'sortable' => true, 'searchable' => true, 'type' => 'link', 'link' => array('idx' => 'customer_id', 'href' => '/admin/customers/edit/id/%s'), 'attributes' => array('class' => 'visible-lg visible-md hidden-xs')); $config['datagrid']['columns'][] = array('label' => $translator->translate('Days left'), 'field' => 'd.date_end', 'alias' => 'daysleft', 'sortable' => true, 'searchable' => false, 'type' => 'integer', 'attributes' => array('class' => 'visible-lg visible-md hidden-xs')); $config['datagrid']['columns'][] = array('label' => $translator->translate('Start date'), 'field' => 'd.date_start', 'alias' => 'date_start', 'sortable' => true, 'searchable' => true, 'type' => 'date', 'attributes' => array('class' => 'visible-lg visible-md hidden-xs')); $config['datagrid']['columns'][] = array('label' => $translator->translate('End date'), 'field' => 'd.date_end', 'alias' => 'date_end', 'sortable' => true, 'searchable' => true, 'type' => 'date', 'attributes' => array('class' => 'visible-lg visible-md hidden-xs')); $config['datagrid']['columns'][] = array('label' => $translator->translate('Statuses'), 'field' => 's.status', 'filterdata' => Statuses::getList('services'), 'type' => 'index', 'alias' => 'status', 'sortable' => true, 'searchable' => true, 'attributes' => array('class' => 'visible-lg visible-md hidden-xs')); $config['datagrid']['fields'] = "d.detail_id as id,\n\t\t\t\t\t\t\t\t\t\t\to.order_number as order_id, \n\t\t\t\t\t\t\t\t\t\t\tp.product_id as product_id, \n\t\t\t\t\t\t\t\t\t\t\tc.customer_id as customer_id, \n\t\t\t\t\t\t\t\t\t\t\tc.company as company, \n\t\t\t\t\t\t\t\t\t\t\tc.lastname as lastname,\n\t\t\t\t\t\t\t\t\t\t\td.order_id, \n\t\t\t\t\t\t\t\t\t\t\tDATE_FORMAT(d.date_start, '" . Settings::getMySQLDateFormat('dateformat') . "') as date_start, \n\t\t\t\t\t\t\t\t\t\t\tDATE_FORMAT(d.date_end, '" . Settings::getMySQLDateFormat('dateformat') . "') as date_end, \n\t\t\t\t\t\t\t\t\t\t\tpd.name as productname, \n\t\t\t\t\t\t\t\t\t\t\tp.type as type, \n\t\t\t\t\t\t\t\t\t\t\ts.status as status, \n\t\t\t\t\t\t\t\t\t\t\toid.relationship_id as oid,\n\t\t\t\t\t\t\t\t\t\t\tdm.domain_id as domain_id,\n\t\t\t\t\t\t\t\t\t\t\tDATEDIFF(d.date_end, CURRENT_DATE) as daysleft, \n\t\t\t\t\t\t\t\t\t\t\tCONCAT(dm.domain, '.', ws.tld ) as domain,\n\t\t\t\t\t\t\t\t\t\t\tbc.name as cycle"; $config['datagrid']['rownum'] = $rowNum; $dq = Doctrine_Query::create()->select($config['datagrid']['fields'])->from('OrdersItems d')->leftJoin('d.Orders o')->leftJoin('d.OrdersItemsDomains oid ON d.detail_id = oid.orderitem_id')->leftJoin('d.BillingCycle bc')->leftJoin('oid.Domains dm')->leftJoin('dm.DomainsTlds dt')->leftJoin('dt.WhoisServers ws')->leftJoin('d.Products p')->leftJoin("p.ProductsData pd WITH pd.language_id = {$ns->idlang}")->leftJoin('p.Taxes t')->leftJoin('o.Customers c')->leftJoin('d.Statuses s')->where('p.type <> ?', 'domain')->andWhere('o.isp_id = ?', Shineisp_Registry::get('ISP')->isp_id); $config['datagrid']['dqrecordset'] = $dq; $config['datagrid']['basepath'] = "/admin/services/"; $config['datagrid']['index'] = "detail_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/services/edit/id/%d"; $config['datagrid']['buttons']['delete']['label'] = $translator->translate('Delete'); $config['datagrid']['buttons']['delete']['cssicon'] = "delete"; $config['datagrid']['buttons']['delete']['action'] = "/admin/services/delete/id/%d"; $config['datagrid']['massactions']['common'] = array('massdelete' => 'Mass Delete', 'bulkexport' => 'Export'); $customacts = array(); $actions = Panels::getActions(); if (!empty($actions)) { foreach ($actions as $registrar => $tasks) { foreach ($tasks as $action => $label) { $customacts['bulk_registrar_tasks&task=' . $action] = $translator->_('%s registrar task: %s', $registrar, $label); } } } $config['datagrid']['massactions']['panels'] = $customacts; return $config; }
/** * Create and Set as active the isp panels * @param unknown_type $panelvar */ public static function setAsActive($panelvar, $ispId) { // Disable all the control panels Doctrine_Query::create()->update('Panels')->set('active', '?', 0)->execute(); if (!empty($panelvar)) { $isppanel = Doctrine_Query::create()->from('Panels')->where("name = ?", $panelvar)->limit(1)->execute(array(), Doctrine::HYDRATE_ARRAY); // ISP Panel module has not been created yet if (empty($isppanel)) { $panel = new Panels(); $path = PROJECT_PATH . "/library/Shineisp/Plugins/Panels/{$panelvar}"; if (!empty($panelvar)) { $config = simplexml_load_file($path . "/config.xml"); if ($config) { $conf = array(); $attributes = $config->attributes(); // create the params array foreach ($config->configuration->children() as $field => $value) { $conf[$field] = (string) $value; } // Save the configuration $panel['name'] = $attributes['name']; $panel['isp_id'] = $ispId; $panel['params'] = json_encode($conf); $panel['active'] = 0; $panel->save(); } } } // Enable only the set isp panel in the ISP Profile return Doctrine_Query::create()->update('Panels')->set('active', '?', 1)->where('name = ?', $panelvar)->execute(); } }
<?php /* |---------------------------------------------------------------------------------- | Panel Routes |---------------------------------------------------------------------------------- | **/ $_route = Config::get('panel.route'); Route::get($_route, function () { return Panels::index(); }); /* |---------------------------------------------------------------------------------- | Users Routes |---------------------------------------------------------------------------------- | **/ Route::get($_route . "/users", function () { return Users::index(); }); Route::get($_route . "/users/list", function () { return Users::list_users(); }); Route::get($_route . "/users/auth", function () { return Users::auth(); }); Route::get($_route . "/users/logout", function () { return Users::Logout(); }); Route::get($_route . "/users/register", function () {
/** * Match all the product attribute fields and IspConfig fields * * * Match all the system product attribute from ShineISP * and the IspConfig fields set in the configuration file * located in the /library/Shineisp/Plugins/Panels/IspConfig/config.xml * * @param array $attributes --> ShineISP System Product Attribute * @param array $record --> IspConfig Client Record * @return ArrayObject */ public function matchFieldsValues(array $attributes, array $record = array()) { $fields = array(); // Loop of system product attributes foreach ($attributes as $attribute => $value) { // Get the saved system attribute $sysAttribute = ProductsAttributes::getAttributebyCode($attribute); if (!empty($sysAttribute[0]['system_var'])) { $sysVariable = $sysAttribute[0]['system_var']; // Get the system product attribute $modAttribute = Panels::getXmlFieldbyAttribute("IspConfig", $sysVariable); if (!empty($modAttribute['field'])) { // Sum the old resource value with the new ones if (!empty($record[$modAttribute['field']])) { /** * Now we have to sum the resource previously added * in the client IspConfig profile with the new one */ if ($modAttribute['type'] == "integer") { if ($record[$modAttribute['field']] == "-1") { $value = "-1"; } else { $value += $record[$modAttribute['field']]; } } } if (!empty($value)) { $fields[$modAttribute['field']] = $value; } else { $fields[$modAttribute['field']] = $modAttribute['default']; } } } } return $fields; }
// handle ajax save request (do not show the interface) // we posted . characters, but something converts them to _ (HTTP 1.1 standard) $r = array(); foreach ($_REQUEST as $i => $v) { $r[join('.', explode('_', $i))] = $v; //convert _ back to . } $Panels = array(); for ($i0 = 0; isset($r['0.' . $i0]); $i0++) { $Panels[$i0] = array('id' => @$r['0.' . $i0 . '.0'], 'panel' => @$r['0.' . $i0 . '.0'], 'court' => @$r['0.' . $i0 . '.1']); $Panels[$i0]['members'] = array(); for ($i1 = 0; isset($r['0.' . $i0 . '.2.' . $i1]); $i1++) { $Panels[$i0]['members'][$i1] = @$r['0.' . $i0 . '.2.' . $i1 . '']; } } $Panels = new Panels($Panels); if ($Panels->save() !== false) { die('ok:' . $_SERVER['PHP_SELF']); } else { die(''); } exit; // do not show the interface } $buttons = ""; if (isset($_REQUEST['edit'])) { $edit = true; } else { $edit = false; } $Panels = new Panels();
/** * processAction * Update the record previously selected * @return unknown_type */ public function processAction() { $redirector = Zend_Controller_Action_HelperBroker::getStaticHelper('redirector'); $form = $this->getForm("/admin/panels/process"); $request = $this->getRequest(); $id = $request->getParam('panel_id'); // 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/panels/list", "label" => $this->translator->translate('List'), "params" => array('css' => null, 'id' => 'submit')), array("url" => "/admin/panels/new/", "label" => $this->translator->translate('New'), "params" => array('css' => null))); if (!empty($id)) { // Add the isp parameters fields $form = Panels::getParameters($request->getParam('panel_id'), $form); } // Check if we have a POST request if (!$request->isPost()) { return $this->_helper->redirector('list', 'panel', 'admin'); } if ($form->isValid($request->getPost())) { // Save all the fields $id = Panels::saveAll($form->getValues()); // Save the isp parameter if ($form->getSubForm('parameters')) { Panels::saveParameterValues($form->getSubForm('parameters')->getValues(), $id); } $redirector->gotoUrl("/admin/panels/edit/id/{$id}"); } else { $this->view->form = $form; $this->view->title = $this->translator->translate("Panels Details"); $this->view->description = $this->translator->translate("Here you can correct the parameters sent"); return $this->render('applicantform'); } }
public function initAll() { // Get the Zend Event Manager $em = Shineisp_Registry::get('em'); $mainConfigfile = APPLICATION_PATH . "/configs/config.xml"; if (file_exists($mainConfigfile)) { $mainconfig = simplexml_load_file($mainConfigfile); } else { throw new Exception($mainConfigfile . " has been not found"); } if (!count($mainconfig->xpath("/shineisp/modules"))) { $modules = $mainconfig->addChild('modules'); } else { $modules = $mainconfig->xpath("/shineisp/modules"); } $path = PROJECT_PATH . "/library/Shineisp/Plugins" . DIRECTORY_SEPARATOR; // << The last slash is very important in the plugin path // Read all the directory recursivelly and get all the files and folders $iterator = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($path)); foreach ($iterator as $filename => $path_object) { $pluginConfigFile = $filename; $info = pathinfo($filename); // Select only the plugins that have a xml configuration file if (!empty($info['extension']) && $info['extension'] == "xml") { // Get the directory of the plugin $PluginPath = $info['dirname']; // Delete the main plugin path $PluginBasePath = str_replace($path, "", $info['dirname']); // Convert the result as array $PluginBasePathArray = explode(DIRECTORY_SEPARATOR, $PluginBasePath); // Create the name of the Plugin class $pluginName = 'Shineisp_Plugins_' . implode("_", $PluginBasePathArray) . '_Main'; // Check if plugins looks good $reflectionClass = new ReflectionClass($pluginName); if (!($reflectionClass->isInstantiable() && $reflectionClass->implementsInterface('Shineisp_Plugins_Interface') && is_callable(array($pluginName, 'events')))) { Shineisp_Commons_Utilities::logs("Skipping not instantiable plugin '" . $pluginName . "'"); continue; } // Initialize $plugin = new $pluginName(); $plugin->events($em); // Check if the Main exists if (file_exists($pluginConfigFile) && is_readable($pluginConfigFile)) { $info = pathinfo($pluginConfigFile); if (!empty($info['extension']) && $info['extension'] == "xml") { if (file_exists($pluginConfigFile)) { $config = simplexml_load_file($pluginConfigFile); // If the config file has been created for the registrar ignore it // because the configuration is delegated to the registrar management if (isset($config->attributes()->type) && "registrars" == (string) $config->attributes()->type) { continue; } $panelName = (string) $config->attributes()->name; $var = (string) $config['var']; // Save the module setup in the config.xml file // Now we are checking if the module is already set in the config.xml file if (!count($mainconfig->xpath("/shineisp/modules/{$var}"))) { // The module is not present, we have to create it $module = $modules[0]->addChild($var); // Now we add the setup date as attribute $module->addAttribute('setup', date('YmdHis')); } else { // The module is present and we get it $module = $mainconfig->xpath("/shineisp/modules/{$var}"); // If the setup date attribute is present skip the module process setup if (!empty($module[0]) && $module[0]->attributes()->setup) { continue; } else { // The setup attribute is not present restart the module setup process $module[0]->addAttribute('setup', date('YmdHis')); } } $help = (string) $config->general->help ? (string) $config->general->help : NULL; $description = (string) $config->general->description ? (string) $config->general->description : NULL; $group_id = SettingsGroups::addGroup($config['name'], $description, $help); if (!empty($config->settings) && $config->settings->children()) { foreach ($config->settings->children() as $node) { $configclass = array(); $arr = $node->attributes(); $var = strtolower($config['var']) . "_" . (string) $arr['var']; $label = (string) $arr['label']; $type = (string) $arr['type']; $description = (string) $arr['description']; if ((string) $arr['configclass']) { $configclass = json_decode((string) $arr['configclass'], true); } if (!empty($var) && !empty($label) && !empty($type)) { SettingsParameters::addParam($label, $description, $var, $type, 'admin', 1, $group_id, $configclass); } } if (!empty($config->customfields)) { foreach ($config->customfields->children() as $node) { $arr = $node->attributes(); $var = (string) $node; $label = (string) $arr['label']; $type = (string) $arr['type']; $section = (string) $arr['section']; // Fetch panel_id from database if (!empty($panelName)) { $Panels = Panels::getAllInfoByName($panelName); } $panel_id = !empty($Panels) && isset($Panels['panel_id']) && $Panels['panel_id'] > 0 ? intval($Panels['panel_id']) : null; if (!empty($var) && !empty($label) && !empty($type)) { CustomAttributes::createAttribute($var, $label, $type, $section, $panel_id); } } } } } $xmlstring = $mainconfig->asXML(); // Prettify and save the xml configuration $dom = new DOMDocument('1.0'); $dom->loadXML($xmlstring); $dom->formatOutput = TRUE; $dom->preserveWhiteSpace = TRUE; $dom->saveXML(); if (!@$dom->save($mainConfigfile)) { throw new Exception("Error on saving the xml file in {$mainConfigfile} <br/>Please check the folder permissions"); } } } } } }
/** * add a task to be done by the cron job */ public static function Addtask($customer_id, $orderitem_id, $action, $parameters = "") { $panel = Panels::getActivePanel(); if (!empty($panel)) { $task = new PanelsActions(); $task->panel_id = $panel['panel_id']; $task->start = date('Y-m-d H:i:s'); $task->customer_id = $customer_id; $task->orderitem_id = $orderitem_id; $task->action = $action; $task->parameters = $parameters; $task->status_id = Statuses::id("active", "domains_tasks"); // Task Processing; return $task->trySave(); } else { return false; } }
/** * Save all the ISP data * * @return string */ public static function saveAll($data, $id = FALSE) { if (is_numeric($id)) { $isp = self::find($id); } else { $isp = new Isp(); } $isp->company = !empty($data['company']) ? $data['company'] : NULL; $isp->vatnumber = !empty($data['vatnumber']) ? $data['vatnumber'] : NULL; $isp->address = !empty($data['address']) ? $data['address'] : NULL; $isp->zip = !empty($data['zip']) ? $data['zip'] : NULL; $isp->city = !empty($data['city']) ? $data['city'] : NULL; $isp->country = !empty($data['country']) ? $data['country'] : NULL; $isp->telephone = !empty($data['telephone']) ? $data['telephone'] : NULL; $isp->fax = !empty($data['fax']) ? $data['fax'] : NULL; $isp->slogan = !empty($data['slogan']) ? $data['slogan'] : NULL; $isp->manager = !empty($data['manager']) ? $data['manager'] : NULL; $isp->website = !empty($data['website']) ? $data['website'] : NULL; $isp->email = !empty($data['email']) ? $data['email'] : NULL; $isp->isppanel = !empty($data['isppanel']) ? $data['isppanel'] : NULL; $isp->bankname = !empty($data['bankname']) ? $data['bankname'] : NULL; $isp->iban = !empty($data['iban']) ? $data['iban'] : NULL; $isp->bic = !empty($data['bic']) ? $data['bic'] : NULL; $isp->custom1 = !empty($data['custom1']) ? $data['custom1'] : NULL; $isp->custom2 = !empty($data['custom2']) ? $data['custom2'] : NULL; $isp->custom3 = !empty($data['custom3']) ? $data['custom3'] : NULL; if (!empty($data['password'])) { $isp->password = md5($data['password']); } if ($isp->trySave()) { $id = $isp['isp_id']; // Upload the logo self::UploadLogo($id); // Set the ISP panel if (!empty($data['isppanel'])) { Panels::setAsActive($data['isppanel'], $isp['isp_id']); } return $isp; } return false; }