/**
  * grid
  * create the configuration of the grid
  */
 public static function grid($rowNum = 10)
 {
     $translator = Shineisp_Registry::getInstance()->Zend_Translate;
     $config['datagrid']['columns'][] = array('label' => null, 'field' => 's.subscriber_id', 'alias' => 'subscriber_id', 'type' => 'selectall');
     $config['datagrid']['columns'][] = array('label' => $translator->translate('ID'), 'field' => 's.subscriber_id', 'alias' => 'subscriber_id', 'sortable' => true, 'searchable' => true, 'type' => 'string');
     $config['datagrid']['columns'][] = array('label' => $translator->translate('Email'), 'field' => 's.email', 'alias' => 'email', 'sortable' => true, 'searchable' => true, 'type' => 'string');
     $config['datagrid']['columns'][] = array('label' => $translator->translate('Subscription Date'), 'field' => 's.subscriptiondate', 'alias' => 'subscriptiondate', 'sortable' => true, 'searchable' => true, 'type' => 'date');
     $config['datagrid']['fields'] = "s.subscriber_id, s.email as email, DATE_FORMAT(s.subscriptiondate, '" . Settings::getMySQLDateFormat('dateformat') . " %H:%i:%s') as subscriptiondate";
     $config['datagrid']['rownum'] = $rowNum;
     $config['datagrid']['dqrecordset'] = Doctrine_Query::create()->select($config['datagrid']['fields'])->from('NewslettersSubscribers s');
     $config['datagrid']['basepath'] = "/admin/subscribers/";
     $config['datagrid']['index'] = "subscriber_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/subscribers/edit/id/%d";
     $config['datagrid']['buttons']['delete']['label'] = $translator->translate('Delete');
     $config['datagrid']['buttons']['delete']['cssicon'] = "delete";
     $config['datagrid']['buttons']['delete']['action'] = "/admin/subscribers/delete/id/%d";
     $config['datagrid']['massactions'] = array('massdelete' => 'Mass Delete', 'bulkexport' => 'Export');
     $bulkmailinglist = array();
     $mailchimplists = Newsletters::get_mailchimp_list();
     if (!empty($mailchimplists)) {
         foreach ($mailchimplists as $id => $name) {
             $bulkmailinglist['bulk_mailchimp_optin&list=' . $id] = "Add to ({$name})";
             $bulkmailinglist['bulk_mailchimp_optout&list=' . $id] = "Remove from ({$name})";
         }
     }
     $config['datagrid']['massactions']['commons'] = array_merge($config['datagrid']['massactions'], $bulkmailinglist);
     return $config;
 }
示例#2
0
 /**
  * List of the last messages attached within the orders, domains, customers detail page
  * 
  * 
  * @param string $attachedto [orders, domains]
  * @param integer $limit
  * @return ArrayObject
  */
 public static function Last($attachedto = "orders", $limit = 5, $delIspReplies = true)
 {
     $translator = Shineisp_Registry::getInstance()->Zend_Translate;
     $dq = Doctrine_Query::create()->from('Messages m');
     // Adding first the main ID index field
     if ($attachedto == "orders") {
         $dq->select("order_id as id");
         $dq->where("order_id IS NOT NULL");
     } elseif ($attachedto == "domains") {
         $dq->select("domain_id as id");
         $dq->where("domain_id IS NOT NULL");
     }
     // now we can add more fields
     $dq->addSelect("DATE_FORMAT(m.dateposted, '" . Settings::getMySQLDateFormat('dateformat') . " %H:%i:%s') as date, m.message as message");
     if ($delIspReplies) {
         $dq->andWhere("customer_id IS NOT NULL");
     }
     // Sort the items
     $dq->orderBy('m.dateposted desc')->limit($limit);
     $records['data'] = $dq->execute(null, Doctrine::HYDRATE_ARRAY);
     // Strip the html and trucate the message
     for ($i = 0; $i < count($records['data']); $i++) {
         $records['data'][$i]['message'] = Shineisp_Commons_Utilities::truncate(strip_tags($records['data'][$i]['message']), 50, "...", false, true);
     }
     // adding the index reference
     $records['index'] = "id";
     // Create the header table columns
     $records['fields'] = array('date' => array('label' => $translator->translate('Date')), 'message' => array('label' => $translator->translate('Message')));
     return $records;
 }
示例#3
0
 /**
  * grid
  * create the configuration of the grid
  */
 public static function grid($rowNum = 10)
 {
     $Session = new Zend_Session_Namespace('Default');
     $translator = Shineisp_Registry::getInstance()->Zend_Translate;
     $config['datagrid']['columns'][] = array('label' => null, 'field' => 'cms.page_id', 'alias' => 'page_id', 'type' => 'selectall');
     $config['datagrid']['columns'][] = array('label' => $translator->translate('ID'), 'field' => 'cms.page_id', 'alias' => 'page_id', 'sortable' => true, 'searchable' => true, 'type' => 'string');
     $config['datagrid']['columns'][] = array('label' => $translator->translate('Title'), 'field' => 'title', 'alias' => 'title', 'sortable' => true, 'searchable' => true, 'type' => 'string');
     $config['datagrid']['columns'][] = array('label' => $translator->translate('Variable'), 'field' => 'var', 'alias' => 'var', 'sortable' => true, 'searchable' => true, 'type' => 'string');
     $config['datagrid']['columns'][] = array('label' => $translator->translate('Date'), 'field' => 'cms.publishedat', 'alias' => 'date', 'sortable' => true, 'searchable' => true, 'type' => 'date');
     $config['datagrid']['columns'][] = array('label' => $translator->translate('Language'), 'type' => 'arraydata', 'index' => 'page_id', 'alias' => 'dummy', 'run' => array('CmsPagesData' => 'getTranslations'));
     $config['datagrid']['fields'] = "cms.page_id, DATE_FORMAT(cms.publishedat, '" . Settings::getMySQLDateFormat('dateformat') . "') as date, cms.title, cms.var";
     $config['datagrid']['rownum'] = $rowNum;
     $config['datagrid']['dqrecordset'] = Doctrine_Query::create()->select($config['datagrid']['fields'])->from('CmsPages cms');
     $config['datagrid']['basepath'] = "/admin/cmspages/";
     $config['datagrid']['index'] = "page_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/cmspages/edit/id/%d";
     $config['datagrid']['buttons']['delete']['label'] = $translator->translate('Delete');
     $config['datagrid']['buttons']['delete']['cssicon'] = "delete";
     $config['datagrid']['buttons']['delete']['action'] = "/admin/cmspages/delete/id/%d";
     $config['datagrid']['massactions']['common'] = array('massdelete' => 'Mass Delete');
     return $config;
 }
示例#4
0
 /**
  * grid
  * create the configuration of the grid
  */
 public static function grid($rowNum = 10)
 {
     $translator = Shineisp_Registry::getInstance()->Zend_Translate;
     $config['datagrid']['columns'][] = array('label' => null, 'field' => 'dt.tld_id', 'alias' => 'tld_id', 'type' => 'selectall');
     $config['datagrid']['columns'][] = array('label' => $translator->translate('ID'), 'field' => 'dt.tld_id', 'alias' => 'tld_id', 'sortable' => true, 'searchable' => true, 'type' => 'string');
     $config['datagrid']['columns'][] = array('label' => $translator->translate('TLD'), 'field' => 'ws.tld', 'alias' => 'tld', 'sortable' => true, 'searchable' => true, 'type' => 'string');
     $config['datagrid']['columns'][] = array('label' => $translator->translate('Registration price'), 'field' => 'dt.new', 'alias' => 'new', 'sortable' => true, 'searchable' => true, 'type' => 'integer', 'attributes' => array('class' => 'visible-lg visible-md hidden-xs'));
     $config['datagrid']['columns'][] = array('label' => $translator->translate('Transfer price'), 'field' => 'dt.transfer', 'alias' => 'transfer', 'sortable' => true, 'searchable' => true, 'type' => 'integer', 'attributes' => array('class' => 'visible-lg visible-md hidden-xs'));
     $config['datagrid']['columns'][] = array('label' => $translator->translate('Renewal price'), 'field' => 'dt.renew', 'alias' => 'renew', 'sortable' => true, 'searchable' => true, 'type' => 'integer', 'attributes' => array('class' => 'visible-lg visible-md hidden-xs'));
     $config['datagrid']['columns'][] = array('label' => $translator->translate('Whois'), 'field' => 'ws.server', 'alias' => 'whois', 'sortable' => true, 'searchable' => true, 'type' => 'string', 'attributes' => array('class' => 'visible-lg visible-md hidden-xs'));
     $config['datagrid']['fields'] = "dt.tld_id, ws.server as whois, ws.tld as tld, dt.registration_price as new, dt.transfer_price as transfer, dt.renewal_price as renew";
     $config['datagrid']['dqrecordset'] = Doctrine_Query::create()->select($config['datagrid']['fields'])->from('DomainsTlds dt')->leftJoin('dt.WhoisServers ws')->leftJoin('dt.DomainsTldsData dtd')->orderBy('ws.tld');
     $config['datagrid']['rownum'] = $rowNum;
     $config['datagrid']['basepath'] = "/admin/domainstlds/";
     $config['datagrid']['index'] = "tld_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/domainstlds/edit/id/%d";
     $config['datagrid']['buttons']['delete']['label'] = $translator->translate('Delete');
     $config['datagrid']['buttons']['delete']['cssicon'] = "delete";
     $config['datagrid']['buttons']['delete']['action'] = "/admin/domainstlds/delete/id/%d";
     $config['datagrid']['massactions'] = array('massdelete' => 'Delete');
     return $config;
 }
示例#5
0
 public function customers()
 {
     $registry = Shineisp_Registry::getInstance();
     $translator = $registry->Zend_Translate;
     $this->view->customers = Customers::getList($translator->translate('Select the customer ...'), array(array('where' => 'u.status_id = ?', 'params' => Statuses::id('active', 'customers'))));
     return $this->view->render('partials/customers.phtml');
 }
示例#6
0
 public function __construct($config = array())
 {
     parent::__construct($config);
     $this->setScriptPath(realpath(APPLICATION_PATH . '/../public') . '/skins/commons/invoices/');
     $this->assign('translator', Shineisp_Registry::getInstance()->Zend_Translate);
     require_once PROJECT_PATH . '/library/html2pdf/html2pdf.class.php';
 }
示例#7
0
 public static function time_since($original)
 {
     $translator = Shineisp_Registry::getInstance()->Zend_Translate;
     $original = strtotime($original);
     // array of time period chunks
     $chunks = array(array(60 * 60 * 24 * 365, $translator->translate('years')), array(60 * 60 * 24 * 30, $translator->translate('months')), array(60 * 60 * 24 * 7, $translator->translate('weeks')), array(60 * 60 * 24, $translator->translate('days')), array(60 * 60, $translator->translate('hours')), array(60, $translator->translate('minutes')));
     $today = time();
     /* Current unix time  */
     $since = $today - $original;
     // $j saves performing the count function each time around the loop
     for ($i = 0, $j = count($chunks); $i < $j; $i++) {
         $seconds = $chunks[$i][0];
         $name = $chunks[$i][1];
         // finding the biggest chunk (if the chunk fits, break)
         if (($count = floor($since / $seconds)) != 0) {
             // DEBUG print "<!-- It's $name -->\n";
             break;
         }
     }
     $print = $count == 1 ? '1 ' . $name : "{$count} {$name}";
     if ($i + 1 < $j) {
         // now getting the second item
         $seconds2 = $chunks[$i + 1][0];
         $name2 = $chunks[$i + 1][1];
         // add second item if it's greater than 0
         if (($count2 = floor(($since - $seconds * $count) / $seconds2)) != 0) {
             $print .= $count2 == 1 ? ', 1 ' . $name2 : ", {$count2} {$name2}";
         }
     }
     return $print;
 }
示例#8
0
 public function init()
 {
     $registry = Shineisp_Registry::getInstance();
     $auth = Zend_Auth::getInstance();
     if ($auth->hasIdentity()) {
         $logged_user = $auth->getIdentity();
     }
     // Set the custom decorator
     $this->addElementPrefixPath('Shineisp_Decorator', 'Shineisp/Decorator/', 'decorator');
     $translate = Shineisp_Registry::get('Zend_Translate');
     $this->addElement('text', 'firstname', array('filters' => array('StringTrim'), 'required' => true, 'label' => $translate->_('Firstname'), 'decorators' => array('Bootstrap'), 'class' => 'form-control'));
     $this->addElement('text', 'lastname', array('filters' => array('StringTrim'), 'required' => true, 'label' => $translate->_('Lastname'), 'decorators' => array('Bootstrap'), 'class' => 'form-control'));
     // Check if the user is an administrator, if not the select role object will become an hidden field
     if (AdminRoles::isAdministrator($logged_user['user_id'])) {
         $this->addElement('select', 'role_id', array('required' => true, 'label' => $translate->_('Role'), 'decorators' => array('Bootstrap'), 'class' => 'form-control'));
         $this->getElement('role_id')->setAllowEmpty(false)->setRegisterInArrayValidator(false)->setMultiOptions(AdminRoles::getList());
         $this->addElement('select', 'isp_id', array('required' => true, 'label' => $translate->_('Isp Company'), 'decorators' => array('Bootstrap'), 'class' => 'form-control'));
         $this->getElement('isp_id')->setAllowEmpty(false)->setRegisterInArrayValidator(false)->setMultiOptions(Isp::getList());
     } else {
         $this->addElement('hidden', 'role_id');
         $this->addElement('hidden', 'isp_id');
     }
     $this->addElement('text', 'email', array('filters' => array('StringTrim', 'StringToLower'), 'decorators' => array('Bootstrap'), 'validators' => array(array('validator' => 'EmailAddress')), 'required' => true, 'label' => $translate->_('Email'), 'class' => 'form-control'));
     $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('hidden', 'user_id');
 }
示例#9
0
 /**
  * preDispatch
  * Starting of the module
  * (non-PHPdoc)
  * @see library/Zend/Controller/Shineisp_Controller_Default#preDispatch()
  */
 public function preDispatch()
 {
     $registry = Shineisp_Registry::getInstance();
     $this->wiki = new Wiki();
     $this->translator = $registry->Zend_Translate;
     $this->getHelper('layout')->setLayout('1column');
 }
示例#10
0
 /**
  * grid
  * create the configuration of the grid
  */
 public static function grid($rowNum = 10)
 {
     $Session = new Zend_Session_Namespace('Default');
     $translator = Shineisp_Registry::getInstance()->Zend_Translate;
     $config['datagrid']['columns'][] = array('label' => null, 'field' => 'u.user_id', 'alias' => 'user_id', 'type' => 'selectall');
     $config['datagrid']['columns'][] = array('label' => $translator->translate('ID'), 'field' => 'u.user_id', 'alias' => 'user_id', 'sortable' => true, 'searchable' => true, 'type' => 'string');
     $config['datagrid']['columns'][] = array('label' => $translator->translate('Firstname'), 'field' => 'u.firstname', 'alias' => 'firstname', 'sortable' => true, 'searchable' => true, 'type' => 'string', 'attributes' => array('class' => "visible-lg visible-md hidden-xs"));
     $config['datagrid']['columns'][] = array('label' => $translator->translate('Lastname'), 'field' => 'u.lastname', 'alias' => 'lastname', 'sortable' => true, 'searchable' => true, 'type' => 'string', 'attributes' => array('class' => "visible-lg visible-md hidden-xs"));
     $config['datagrid']['columns'][] = array('label' => $translator->translate('E-Mail'), 'field' => 'u.email', 'alias' => 'email', 'sortable' => true, 'searchable' => true, 'type' => 'string', 'attributes' => array('class' => "visible-lg visible-md hidden-xs"));
     $config['datagrid']['columns'][] = array('label' => $translator->translate('Role'), 'field' => 'r.name', 'alias' => 'role', 'sortable' => true, 'searchable' => true, 'type' => 'string');
     $config['datagrid']['fields'] = "u.user_id, u.firstname, u.lastname, u.email, r.name as role";
     $config['datagrid']['rownum'] = $rowNum;
     $config['datagrid']['dqrecordset'] = Doctrine_Query::create()->select($config['datagrid']['fields'])->from('AdminUser u')->leftJoin('u.AdminRoles r');
     $config['datagrid']['basepath'] = "/admin/profile/";
     $config['datagrid']['index'] = "user_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/profile/edit/id/%d";
     $config['datagrid']['buttons']['delete']['label'] = $translator->translate('Delete');
     $config['datagrid']['buttons']['delete']['cssicon'] = "delete";
     $config['datagrid']['buttons']['delete']['action'] = "/admin/profile/delete/id/%d";
     $config['datagrid']['massactions'] = array('massdelete' => 'Mass Delete');
     return $config;
 }
示例#11
0
 /**
  * grid
  * create the configuration of the grid
  */
 public static function grid($rowNum = 10)
 {
     $translator = Shineisp_Registry::getInstance()->Zend_Translate;
     // Return usage/max_services or usage/infinity if max_services is 0 or null
     $sqlIF = "\r\n\t\t\t(IF ( s.max_services \r\n     \t\t\t ,CONCAT(s.services,'/',s.max_services,' (',ROUND(s.services*100/s.max_services),'%)')\r\n     \t\t\t ,CONCAT(s.services,'/&infin;') \r\n\t\t\t))\r\n\t\t";
     $config['datagrid']['columns'][] = array('label' => null, 'field' => 's.server_id', 'alias' => 'server_id', 'type' => 'selectall');
     $config['datagrid']['columns'][] = array('label' => $translator->translate('ID'), 'field' => 's.server_id', 'alias' => 'server_id', 'sortable' => true, 'searchable' => true, 'type' => 'string');
     $config['datagrid']['columns'][] = array('label' => $translator->translate('Name'), 'field' => 'r.subject', 'alias' => 'servername', 'sortable' => true, 'searchable' => true, 'type' => 'string');
     $config['datagrid']['columns'][] = array('label' => $translator->translate('IP'), 'field' => 's.ip', 'alias' => 'ip', 'sortable' => true, 'searchable' => true, 'attributes' => array('class' => "visible-lg visible-md hidden-xs"));
     $config['datagrid']['columns'][] = array('label' => $translator->translate('Status'), 'field' => 'stat.status', 'alias' => 'status', 'sortable' => true, 'searchable' => true, 'attributes' => array('class' => "visible-lg visible-md hidden-xs"));
     $config['datagrid']['columns'][] = array('label' => $translator->translate('Usage'), 'field' => 's.usage', 'alias' => 'usage', 'sortable' => false, 'searchable' => false, 'attributes' => array('class' => "visible-lg visible-md hidden-xs"));
     $config['datagrid']['columns'][] = array('label' => $translator->translate('Panel'), 'field' => 'panel.name', 'alias' => 'panel_name', 'sortable' => true, 'searchable' => true, 'attributes' => array('class' => "visible-lg visible-md hidden-xs"));
     $config['datagrid']['fields'] = "s.server_id, s.name as servername, " . $sqlIF . " AS usage, s.max_services AS max_services, s.ip as ip, stat.status as status, panel.name as panel_name";
     $config['datagrid']['dqrecordset'] = Doctrine_Query::create()->select($config['datagrid']['fields'])->from('Servers s')->leftJoin('s.Isp i')->leftJoin('s.Servers_Types st')->leftJoin('s.Statuses stat')->leftJoin('s.Panels panel');
     $config['datagrid']['rownum'] = $rowNum;
     $config['datagrid']['basepath'] = "/admin/servers/";
     $config['datagrid']['index'] = "server_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/servers/edit/id/%d";
     $config['datagrid']['buttons']['delete']['label'] = $translator->translate('Delete');
     $config['datagrid']['buttons']['delete']['cssicon'] = "delete";
     $config['datagrid']['buttons']['delete']['action'] = "/admin/servers/delete/id/%d";
     $config['datagrid']['massactions'] = array('massdelete' => 'Mass Delete');
     return $config;
 }
示例#12
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;
 }
示例#13
0
 public function tldSummaryPerMonth()
 {
     $NS = new Zend_Session_Namespace('Default');
     $registry = Shineisp_Registry::getInstance();
     $translation = $registry->Zend_Translate;
     $domains = array();
     if (!empty($NS->customer)) {
         $this->view->uri = "";
         $data = $NS->customer;
         // Get the data information
         $all_domains = Domains::getSummaryPerMonth($data['customer_id']);
         $autorenew_domains = Domains::getAutorenewSummaryPerMonth($data['customer_id']);
         for ($i = 1; $i <= 12; $i++) {
             $domains['months'][$i] = date('M', strtotime(date('Y/m/01/', strtotime("2012/12/1")) . " {$i} month"));
             $domains['autorenew'][$i] = 0;
             $domains['norenew'][$i] = 0;
             foreach ($autorenew_domains as $domain) {
                 if ($domain['monthid'] == $i) {
                     $domains['autorenew'][$i] = $domain['total'];
                 }
             }
             foreach ($all_domains as $domain) {
                 if ($domain['month_number'] == $i) {
                     $domains['norenew'][$i] = $domain['total'] - $domains['autorenew'][$i];
                 }
             }
         }
         $norenew = implode(",", $domains['norenew']);
         $autorenew = implode(",", $domains['autorenew']);
         $months = implode("|", $domains['months']);
         $max = max($domains['autorenew']);
         $this->view->uri = "http://chart.apis.google.com/chart?cht=bvg\n\t\t\t&chdlp=t\n\t\t\t&chtt=" . $translation->translate('Domain Summary per Month') . "\n\t\t\t&chdl=" . $translation->translate('Automatic Renewal') . "|" . $translation->translate('No Auto Renew') . "\n\t\t\t&chts=4d89f9,18\n\t\t\t&chs=550x300\n\t\t\t&chd=t:" . $autorenew . "|" . $norenew . "\n\t\t\t&chxt=x\n\t\t\t&chxl=0:|" . $months . "\n\t\t\t&chco=4d89f9,FF1F1F\n\t\t\t&chds=0," . $max . "\n\t\t\t&chm=N,000000,-1,,11|N,000000,0,,11\n\t\t\t&chbh=a";
     }
     return $this->view->render('partials/graph.phtml');
 }
示例#14
0
 public function Show($parameters)
 {
     $output = "";
     $ns = new Zend_Session_Namespace();
     $languageID = Languages::get_language_id($ns->lang);
     $mainviewhelper = new Zend_View();
     $mainviewhelper->addBasePath(APPLICATION_PATH . '/modules/default/views/');
     $view = new Zend_View();
     $view->addScriptPath('../library/Shineisp/Custom/views');
     $translator = Shineisp_Registry::getInstance()->Zend_Translate;
     if (!empty($parameters['code'])) {
         $code = $parameters['code'];
     } else {
         return "";
     }
     // Get the products
     $data = Products::GetProductsByGroupCode($code, $languageID);
     // Check the existence of the mandatories attributes
     if (!empty($data['attributes'][0])) {
         $view->attributes = $data['attributes'];
     }
     // Check if there are values set for the group of the product selected
     if (!empty($data['attributes_values'][0])) {
         $view->values = $data['attributes_values'];
     }
     // Get the products
     if (!empty($data['products'][0])) {
         $view->products = $data['products'];
     }
     $view->mainviewhelper = $mainviewhelper;
     // Path of the template
     return $view->render('productsattributes.phtml');
 }
示例#15
0
 /**
  * create the configuration of the grid
  */
 public static function grid($rowNum = 10)
 {
     $translator = Shineisp_Registry::getInstance()->Zend_Translate;
     $config['datagrid']['columns'][] = array('label' => null, 'field' => 'dp.profile_id', 'alias' => 'profile_id', 'type' => 'selectall');
     $config['datagrid']['columns'][] = array('label' => $translator->translate('ID'), 'field' => 'dp.profile_id', 'alias' => 'profile_id', 'sortable' => true, 'searchable' => true, 'type' => 'string');
     $config['datagrid']['columns'][] = array('label' => $translator->translate('Owner'), 'field' => "CONCAT(c.lastname, ' ', c.firstname)", 'alias' => 'owner', 'sortable' => true, 'searchable' => true, 'type' => 'link', 'link' => array('idx' => 'customer_id', 'href' => '/admin/customers/edit/id/%s'));
     $config['datagrid']['columns'][] = array('label' => $translator->translate('Company'), 'field' => 'dp.company', 'alias' => 'company', 'sortable' => true, 'searchable' => true, 'type' => 'string');
     $config['datagrid']['columns'][] = array('label' => $translator->translate('Full name'), 'field' => 'CONCAT(dp.firstname, " ", dp.lastname)', 'alias' => 'fullname', 'sortable' => true, 'searchable' => true, 'type' => 'string', 'attributes' => array('class' => 'visible-lg visible-md hidden-xs'));
     $config['datagrid']['columns'][] = array('label' => $translator->translate('Email'), 'field' => 'dp.email', 'alias' => 'email', 'sortable' => true, 'searchable' => true, 'type' => 'string', 'attributes' => array('class' => 'visible-lg visible-md hidden-xs'));
     $config['datagrid']['columns'][] = array('label' => $translator->translate('Statuses'), 'field' => 's.status', 'alias' => 'status', 'sortable' => true, 'type' => 'index', 'searchable' => true, 'filterdata' => Statuses::getList('customers'), 'attributes' => array('class' => 'visible-lg visible-md hidden-xs'));
     $config['datagrid']['fields'] = "dp.profile_id,\n\t\t\t\t\t\t\t\t\t\t   dp.company as company,\n\t\t\t\t\t\t\t\t\t\t   CONCAT(c.lastname, ' ', c.firstname) as owner,\n\t\t\t\t\t\t\t\t\t\t   c.customer_id as customer_id,\n\t\t\t\t\t\t\t\t\t\t   CONCAT(dp.firstname, ' ', dp.lastname) as fullname,\n\t\t\t\t\t\t\t\t\t\t   dp.email as email,\n\t\t\t\t\t\t\t\t\t\t   s.status as status";
     $config['datagrid']['rownum'] = $rowNum;
     $dq = Doctrine_Query::create()->select($config['datagrid']['fields'])->from('DomainsProfiles dp')->leftJoin('dp.Statuses s')->leftJoin('dp.Customers c');
     $config['datagrid']['dqrecordset'] = $dq;
     $config['datagrid']['basepath'] = "/admin/domainsprofiles/";
     $config['datagrid']['index'] = "profile_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/domainsprofiles/edit/id/%d";
     $config['datagrid']['buttons']['delete']['label'] = $translator->translate('Delete');
     $config['datagrid']['buttons']['delete']['cssicon'] = "delete";
     $config['datagrid']['buttons']['delete']['action'] = "/admin/domainsprofiles/confirm/id/%d";
     $config['datagrid']['massactions']['common'] = array();
     return $config;
 }
示例#16
0
 /**
  * preDispatch
  * Starting of the module
  * (non-PHPdoc)
  * @see library/Zend/Controller/Shineisp_Controller_Default#preDispatch()
  */
 public function preDispatch()
 {
     $auth = Zend_Auth::getInstance();
     $registry = Shineisp_Registry::getInstance();
     $this->categories = new ProductsCategories();
     $this->translator = $registry->Zend_Translate;
 }
示例#17
0
 public function preDispatch()
 {
     $registry = Shineisp_Registry::getInstance();
     $this->translations = $registry->Zend_Translate;
     $this->_helper->layout()->disableLayout();
     $this->_helper->viewRenderer->setNoRender(true);
 }
示例#18
0
 public function Status($items)
 {
     $translation = Shineisp_Registry::getInstance()->Zend_Translate;
     $this->view->data = $items;
     // Path of the template
     return $this->view->render('partials/status.phtml');
 }
 public function preDispatch()
 {
     $this->session = new Zend_Session_Namespace('Admin');
     $this->productsattributesgroups = new ProductsAttributesGroups();
     $this->translator = Shineisp_Registry::getInstance()->Zend_Translate;
     $this->datagrid = $this->_helper->ajaxgrid;
     $this->datagrid->setModule("productsattributesgroups")->setModel($this->productsattributesgroups);
 }
示例#20
0
 /**
  * preDispatch
  * Starting of the module
  * (non-PHPdoc)
  * @see library/Zend/Controller/Zend_Controller_Action#preDispatch()
  */
 public function preDispatch()
 {
     $this->session = new Zend_Session_Namespace('Admin');
     $this->subscribers = new NewslettersSubscribers();
     $this->translator = Shineisp_Registry::getInstance()->Zend_Translate;
     $this->datagrid = $this->_helper->ajaxgrid;
     $this->datagrid->setModule("subscribers")->setModel($this->subscribers);
 }
示例#21
0
 /**
  * preDispatch
  * Starting of the module
  * (non-PHPdoc)
  * @see library/Zend/Controller/Zend_Controller_Action#preDispatch()
  */
 public function preDispatch()
 {
     $this->session = new Zend_Session_Namespace('Admin');
     $this->urlrewrite = new UrlRewrite();
     $this->translator = Shineisp_Registry::getInstance()->Zend_Translate;
     $this->datagrid = $this->_helper->ajaxgrid;
     $this->datagrid->setModule("urlrewrite")->setModel($this->urlrewrite);
 }
示例#22
0
 /**
  * preDispatch
  * Starting of the module
  * (non-PHPdoc)
  * @see library/Zend/Controller/Zend_Controller_Action#preDispatch()
  */
 public function preDispatch()
 {
     $this->session = new Zend_Session_Namespace('Admin');
     $this->cmsblocks = new CmsBlocks();
     $this->translator = Shineisp_Registry::getInstance()->Zend_Translate;
     $this->datagrid = $this->_helper->ajaxgrid;
     $this->datagrid->setModule("cmsblocks")->setModel($this->cmsblocks);
 }
示例#23
0
文件: Pdf.php 项目: kokkez/shineisp
 /**
  * Construct function inizialize the class
  */
 public function __construct()
 {
     $this->h = PAGE_HEIGHT;
     $this->pdf = new Zend_Pdf();
     $this->font = Zend_Pdf_Font::FONT_HELVETICA;
     $this->data = array();
     $this->translator = Shineisp_Registry::getInstance()->Zend_Translate;
 }
 public function preDispatch()
 {
     $this->session = new Zend_Session_Namespace('Admin');
     $this->emailstemplates = new EmailsTemplates();
     $this->translator = Shineisp_Registry::getInstance()->Zend_Translate;
     $this->datagrid = $this->_helper->ajaxgrid;
     $this->datagrid->setModule("emailstemplates")->setModel($this->emailstemplates);
 }
 /**
  * preDispatch
  * Starting of the module
  * (non-PHPdoc)
  * @see library/Zend/Controller/Zend_Controller_Action#preDispatch()
  */
 public function preDispatch()
 {
     $this->session = new Zend_Session_Namespace('Admin');
     $this->translator = Shineisp_Registry::getInstance()->Zend_Translate;
     $this->categories = new PurchaseCategories();
     $this->datagrid = $this->_helper->ajaxgrid;
     $this->datagrid->setModule("admin")->setModel($this->categories);
 }
示例#26
0
 /**
  * __construct
  * @param integer $orderid
  * @return array
  */
 public function __construct($orderid)
 {
     $order = Orders::getAllInfo($orderid, 'o.*, oi.*, c.*', true);
     $this->orderid = $orderid;
     if (!empty($order[0])) {
         $this->order = $order[0];
     }
     $this->translator = Shineisp_Registry::getInstance()->Zend_Translate;
 }
示例#27
0
 public function signinAction()
 {
     $request = $this->getRequest();
     $NS = new Zend_Session_Namespace('Default');
     $translator = Shineisp_Registry::getInstance()->Zend_Translate;
     $customerparams = array();
     // Check the request of redirection of the user
     $redir = $request->getParam('redir');
     // Check if we have a POST request
     if (!$request->isPost()) {
         return $this->_helper->redirector('login', 'customer');
     }
     // Get our form and validate it
     $form = new Default_Form_LoginForm(array('action' => '/customer/signin/redir/' . $redir, 'method' => 'post'));
     if (!$form->isValid($request->getPost())) {
         // Invalid entries
         $this->view->form = $form;
         return $this->_helper->viewRenderer('login');
         // re-render the login form
     }
     // Get the values posted
     $params = $form->getValues();
     $auth = Zend_Auth::getInstance();
     $auth->setStorage(new Zend_Auth_Storage_Session('default'));
     // Get the customer
     $retval = Customers::login($params['email'], $params['password']);
     if (empty($retval)) {
         $result = new Zend_Auth_Result(Zend_Auth_Result::FAILURE_CREDENTIAL_INVALID, $params['email']);
         $NS->customer = null;
         $this->view->form = $form;
         $this->view->message = $translator->translate('User not found. Please check your credentials.');
         return $this->_helper->viewRenderer('login');
         // re-render the login form
     } else {
         $result = new Zend_Auth_Result(Zend_Auth_Result::SUCCESS, null);
         $customer = Customers::getAllInfo($retval['customer_id'], "c.customer_id, a.address_id, cts.type_id, l.legalform_id, ct.country_id, cn.contact_id, s.status_id, c.*, a.*, l.*, cn.*, cts.*, s.*");
         $NS->customer = $customer;
         // Set the default control panel language
         if (!empty($retval['language'])) {
             $lang = $retval['language'];
         }
     }
     // We're authenticated! Redirect to the home page
     $auth->getStorage()->write($retval);
     // If exist a redirect request the client will be redirect after the login action
     if (!empty($NS->goto) && is_array($NS->goto)) {
         $this->_helper->redirector($NS->goto['action'], $NS->goto['controller'], $NS->goto['module'], $NS->goto['options']);
     }
     if (!empty($lang)) {
         $this->_helper->redirector('index', 'dashboard', 'default', array('lang' => $lang));
         // back to login page
     } else {
         $this->_helper->redirector('index', 'dashboard', 'default');
     }
 }
示例#28
0
 public function preDispatch()
 {
     $this->controller = $this->getActionController();
     $this->view = $this->controller->view;
     if (!empty(Shineisp_Registry::getInstance()->Zend_Translate)) {
         $this->translator = Shineisp_Registry::getInstance()->Zend_Translate;
     }
     $this->redirector = $this->_actionController->getHelper('Redirector');
     $this->view->mex = $this->getRequest()->getParam('mex');
     $this->view->mexstatus = $this->getRequest()->getParam('status');
 }
示例#29
0
文件: Admin.php 项目: kokkez/shineisp
 public function postDispatch()
 {
     $controller_name = $this->getRequest()->getControllerName();
     $controller_action = $this->getRequest()->getActionName();
     $controller_name = ucwords($controller_name);
     $controller_action = ucwords($controller_action);
     $controller_name = Shineisp_Registry::getInstance()->Zend_Translate->translate($controller_name);
     $controller_action = Shineisp_Registry::getInstance()->Zend_Translate->translate($controller_action);
     $this->view->headTitle()->prepend($controller_action);
     $this->view->headTitle()->prepend($controller_name);
 }
示例#30
0
 /**
  * preDispatch
  * Starting of the module
  * (non-PHPdoc)
  * @see library/Zend/Controller/Zend_Controller_Action#preDispatch()
  */
 public function preDispatch()
 {
     $registry = Shineisp_Registry::getInstance();
     $auth = Zend_Auth::getInstance();
     if ($auth->hasIdentity()) {
         $this->isp = $auth->getIdentity();
     } else {
         return $this->_helper->redirector('out', 'login', 'admin');
     }
     $this->translator = $registry->Zend_Translate;
 }