Beispiel #1
0
 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', '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');
 }
Beispiel #3
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;
 }
Beispiel #4
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');
 }
Beispiel #5
0
 public function listAction()
 {
     $ns = new Zend_Session_Namespace();
     $translator = Shineisp_Registry::getInstance()->Zend_Translate;
     $pages = CmsPages::getblogpages($ns->lang);
     $isp = Isp::getActiveISP();
     $this->view->headerdata = array('title' => $translator->_("%s's blog", $isp['company']));
     $this->view->pages = $pages;
 }
Beispiel #6
0
 public function init()
 {
     // Get authenticated user
     $auth = Zend_Auth::getInstance()->getIdentity();
     // Store logged ISP. I'm inside admin, se we use only the logged user
     if (isset($auth['isp_id'])) {
         $isp_id = intval($auth['isp_id']);
         $ISP = new Isp();
         Shineisp_Registry::set('ISP', $ISP->find($isp_id));
     }
     // Load all the status in the registry
     $statusreg = Shineisp_Registry::get('Status');
     if (empty($statusreg)) {
         $status = Statuses::getAll();
         Shineisp_Registry::set('Status', $status);
     }
     parent::init();
 }
Beispiel #7
0
 public function init()
 {
     // Set the custom decorator
     $this->addElementPrefixPath('Shineisp_Decorator', 'Shineisp/Decorator/', 'decorator');
     $translate = Shineisp_Registry::get('Zend_Translate');
     $this->addElement('text', 'name', array('filters' => array('StringTrim'), 'required' => true, 'decorators' => array('Bootstrap'), 'label' => $translate->_('Name'), 'class' => 'form-control'));
     $this->addElement('select', 'isp_id', array('decorators' => array('Bootstrap'), 'label' => $translate->_('ISP Profile'), 'class' => 'form-control'));
     $this->getElement('isp_id')->setAllowEmpty(false)->setRegisterInArrayValidator(false)->setMultiOptions(Isp::getList());
     $this->addElement('select', 'active', array('label' => $translate->_('Active'), 'decorators' => array('Bootstrap'), 'class' => 'form-control', 'multioptions' => array('0' => 'No', '1' => 'Yes')));
     $this->addElement('hidden', 'panel_id');
 }
Beispiel #8
0
 public function init()
 {
     // Set the custom decorator
     $this->addElementPrefixPath('Shineisp_Decorator', 'Shineisp/Decorator/', 'decorator');
     $translate = Shineisp_Registry::get('Zend_Translate');
     $this->addElement('select', 'parameter_id', array('filters' => array('StringTrim'), 'label' => $translate->_('parameter'), 'decorators' => array('Bootstrap'), 'class' => 'form-control'));
     $this->getElement('parameter_id')->setAllowEmpty(false)->setMultiOptions(SettingsParameters::getList('admin'));
     $this->addElement('textarea', 'value', array('filters' => array('StringTrim'), 'required' => true, 'label' => $translate->_('value'), 'decorators' => array('Bootstrap'), 'class' => 'form-control'));
     $this->addElement('select', 'isp_id', array('filters' => array('StringTrim'), 'required' => true, 'label' => $translate->_('Isp'), 'decorators' => array('Bootstrap'), 'class' => 'form-control'));
     $this->getElement('isp_id')->setAllowEmpty(false)->setMultiOptions(Isp::getList());
     $this->addElement('hidden', 'setting_id');
 }
Beispiel #9
0
 public function init()
 {
     try {
         // Store logged ISP. I'm in the public area, se we use only the URL
         $ISP = Isp::findByUrl($_SERVER['HTTP_HOST']);
         if (!empty($ISP)) {
             Shineisp_Registry::set('ISP', $ISP);
         }
         // Load all the status in the registry
         $statusreg = Shineisp_Registry::get('Status');
         if (empty($statusreg)) {
             $status = Statuses::getAll();
             Shineisp_Registry::set('Status', $status);
         }
     } catch (Exception $e) {
         Shineisp_Commons_Utilities::log(__METHOD__ . " " . $e->getMessage());
     }
     parent::init();
 }
Beispiel #10
0
 /**
  * CreateForm
  * Create the skrill form
  * @return string
  */
 public function CreateForm()
 {
     $order = self::getOrder();
     $bank = self::getModule();
     $isp = Isp::getActiveISP();
     $translator = self::getTranslator();
     // Check the skrill account field value
     if (empty($bank['account'])) {
         return null;
     }
     if ($order) {
         $form = "";
         $url = $bank['test_mode'] ? $bank['url_test'] : $bank['url_official'];
         if (!self::isHidden()) {
             $form .= "<div class=\"skrill_" . $bank['name'] . "\">" . $bank['description'] . "</div>";
         }
         $form .= '<form id="skrill" method="POST" action="' . $url . '">';
         $form .= '<input type="hidden" name="recipient_description" value="' . $isp['company'] . '"/>';
         $form .= '<input type="hidden" name="firstname" value="' . $order['Customers']['firstname'] . '"/>';
         $form .= '<input type="hidden" name="lastname" value="' . $order['Customers']['lastname'] . '"/>';
         $form .= '<input type="hidden" name="pay_from_email" value="' . $order['Customers']['email'] . '"/>';
         $form .= '<input type="hidden" name="pay_to_email" value="' . $bank['account'] . '"/>';
         $form .= '<input type="hidden" name="language" value="' . strtoupper($translator->getAdapter()->getLocale()) . '"/>';
         $form .= '<input type="hidden" name="amount" value="' . number_format($order['grandtotal'], 2, '.', '') . '"/>';
         $form .= '<input type="hidden" name="currency" value="EUR"/>';
         $form .= '<input type="hidden" name="transaction_id" value="' . self::getOrderID() . '"/>';
         $form .= '<input type="hidden" name="detail1_description" value="' . $translator->translate('Order No.') . '"/>';
         $form .= '<input type="hidden" name="detail1_text" value="' . self::getOrderID() . " - " . date('Y') . '"/>';
         $form .= '<input type="hidden" name="return_url" value="' . self::getUrlOk() . '"/>';
         $form .= '<input type="hidden" name="cancel_url" value="' . self::getUrlKo() . '"/>';
         $form .= '<input type="hidden" name="status_url" value="' . self::getUrlCallback() . '"/>';
         if (!self::doRedirect()) {
             $form .= '<input class="btn btn-success" type="submit" name="submit" value="' . $translator->translate('Pay Now') . '">';
         }
         $form .= '</form>';
         if (self::doRedirect()) {
             $form .= $translator->translate('You will be redirected to the secure bank website, please be patient.');
             $form .= "<script type=\"text/javascript\">\nsetTimeout(function () {\n\$('#skrill').submit();\n}, 3000);\n</script>";
         }
         return array('name' => $bank['name'], 'description' => $bank['description'], 'html' => $form);
     }
 }
 /**
  * Step 2: Save the data
  */
 public function saveAction()
 {
     $session = new Zend_Session_Namespace('setup');
     $request = $this->getRequest();
     $form = new Setup_Form_PreferencesForm(array('action' => '/setup/preferences/save', 'method' => 'post'));
     // Check if we have a POST request
     if (!$request->isPost()) {
         return $this->_helper->redirector('index', 'preferences', 'setup');
     }
     try {
         if ($form->isValid($request->getPost())) {
             // Get the values posted
             $params = $form->getValues();
             $session->preferences = $params;
             // Create the main xml config file
             if (Settings::saveConfig($session->db)) {
                 // Start the creation of the database tables
                 Settings::createDb();
                 // Get the default ISP company
                 $isp_id = Isp::getActiveISPID();
                 // Save the company information
                 Isp::saveAll($params, $isp_id);
                 // TODO: Bind ISP to the current URL
                 $IspUrls = new IspUrls();
                 $IspUrls->isp_id = $isp_id;
                 $IspUrls->url = $_SERVER['HTTP_HOST'];
                 $IspUrls->save();
                 // Adding the user as administrator
                 AdminUser::addUser($params['firstname'], $params['lastname'], $params['email'], $params['password'], $isp_id);
                 // Redirect the user to the homepage
                 $this->_helper->redirector('index', 'summary', 'setup');
             }
             // There was a problem the setup restarts
             $this->_helper->redirector('index', 'index', 'setup');
         }
     } catch (Exception $e) {
         die($e->getMessage());
     }
     $this->view->form = $form;
     return $this->_helper->viewRenderer('form');
 }
Beispiel #12
0
 public function indexAction()
 {
     $auth = Zend_Auth::getInstance();
     $registry = Shineisp_Registry::getInstance();
     $translation = Shineisp_Registry::get('Zend_Translate');
     $retval = array();
     if ($auth->hasIdentity()) {
         $request = Zend_Controller_Front::getInstance()->getRequest();
         try {
             $form = new Admin_Form_BulkmailForm(array('action' => '/admin/bulkmail/#bulkmail', 'method' => 'post'));
             if ($request->isPost()) {
                 $isp = Isp::getActiveISP();
                 if ($form->isValid($request->getPost())) {
                     $data = $request->getPost();
                     $mail = new Bulkmails();
                     $mail->subject = $data['subject'];
                     $mail->body = $data['body'];
                     $mail->senddate = date('Y-m-d H:i:s');
                     $mail->save();
                     $customers = Customers::getEmails();
                     foreach ($customers as $customer) {
                         $body = str_replace('{fullname}', $customer['fullname'], $data['body']);
                         $result = Shineisp_Commons_Utilities::SendEmail($isp['email'], $customer['email'], null, $data['subject'], $body, true);
                         if ($result !== true) {
                             $retval[] = $result;
                         }
                     }
                 }
             }
             $retval = count($retval) > 0 ? $retval : null;
             $this->view->form = $form;
             $this->view->title = $translation->translate("Mass eMail");
             $this->view->description = $translation->translate("Write here a message to send to all your own customers.");
             $this->view->errors = $retval;
         } catch (Exception $e) {
             die($e->getMessage());
         }
     }
 }
Beispiel #13
0
 /**
  * export the content in a pdf file
  * @param array $items
  */
 public function bulk_export($items)
 {
     $isp = Isp::getActiveISP();
     $pdf = new Shineisp_Commons_PdfList();
     $translator = Shineisp_Registry::getInstance()->Zend_Translate;
     // Get the records from the order table
     $creditnotes = self::get_items($items, "creditnote_id, i.number as invoicenum, DATE_FORMAT(o.order_date, '" . Settings::getMySQLDateFormat('dateformat') . "') as orderdate, c.company as company, CONCAT(c.firstname, ' ', c.lastname) as fullname, cn.total as total, cn.total_vat as vat, cn.total as grandtotal, s.status as status", 'cn.creationdate');
     // Create the PDF header
     $grid['headers']['title'] = $translator->translate('Credit Note List');
     $grid['headers']['subtitle'] = $translator->translate('List Credit Notes');
     $grid['footer']['text'] = $isp['company'] . " - " . $isp['website'];
     if (!empty($creditnotes[0])) {
         // Create the columns of the grid
         $grid['columns'][] = array("value" => $translator->translate('Credit Note'), 'size' => 50);
     }
     $grid['columns'][] = array("value" => $translator->translate('Invoice'), 'size' => 50);
     $grid['columns'][] = array("value" => $translator->translate('Date'), 'size' => 100);
     $grid['columns'][] = array("value" => $translator->translate('Company'));
     $grid['columns'][] = array("value" => $translator->translate('Fullname'));
     $grid['columns'][] = array("value" => $translator->translate('Total'), 'size' => 50);
     $grid['columns'][] = array("value" => $translator->translate('VAT'), 'size' => 50);
     $grid['columns'][] = array("value" => $translator->translate('Grand Total'), 'size' => 50);
     $grid['columns'][] = array("value" => $translator->translate('Status'), 'size' => 100);
     // Getting the records values and delete the first column the customer_id field.
     foreach ($creditnotes as $item) {
         $values = array_values($item);
         $grid['records'][] = $values;
     }
     // Create the PDF
     die($pdf->create($grid));
     return false;
 }
Beispiel #14
0
 /**
  * Get a customer by id lists
  * @param array $ids [1,2,3,4,...,n]
  * @param string $fields
  * @return Array
  */
 public static function get_products($ids = array(), $fields = null, $locale = 1)
 {
     $dq = Doctrine_Query::create()->from('Products p')->leftJoin('p.ProductsAttributesGroups pag')->leftJoin("p.ProductsData pd WITH pd.language_id = {$locale}")->leftJoin('p.Taxes t')->leftJoin('p.ProductsAttributesIndexes pai')->leftJoin('p.ProductsTranches pt')->leftJoin('p.ProductsMedia pm')->leftJoin('pt.BillingCycle bc')->andWhere("isp_id = ?", Isp::getCurrentId());
     if (!empty($fields)) {
         $dq->select($fields);
     }
     if (!empty($ids)) {
         $dq->whereIn("product_id", $ids);
     }
     return $dq->execute(array(), Doctrine::HYDRATE_ARRAY);
 }
Beispiel #15
0
 /**
  * Execute the request of the admin user to change the password
  */
 public function dopasswordAction()
 {
     $code = $this->getRequest()->getParam('id');
     $user = AdminUser::checkMD5CredencialsByIspEmail($code);
     $translator = Shineisp_Registry::getInstance()->Zend_Translate;
     $form = new Admin_Form_PasswordForm(array('action' => '/admin/login/password', 'method' => 'post'));
     if (!empty($user)) {
         $isp = Isp::getActiveISP();
         // Get the template from the main email template folder
         $retval = Shineisp_Commons_Utilities::getEmailTemplate('isp_password_changed');
         $newpassword = AdminUser::resetPassword($user['user_id']);
         if (!empty($retval)) {
             $subject = $retval['subject'];
             $template = $retval['template'];
             $subject = str_replace("[lastname]", $user['lastname'], $subject);
             $template = str_replace("[lastname]", $user['lastname'], $template);
             $template = str_replace("[admin_url]", "http://" . $_SERVER['HTTP_HOST'] . "/admin/", $template);
             $template = str_replace("[email]", $user['email'], $template);
             $template = str_replace("[password]", $newpassword, $template);
             $template = str_replace("[signature]", $isp['company'], $template);
             Shineisp_Commons_Utilities::SendEmail($user['email'], $user['email'], null, $subject, $template);
             $this->view->message = $translator->translate('An email has been sent with the new login credentials');
         }
     }
     $this->view->passwordform = $form;
     return $this->render('password');
     // re-render the login form
 }
Beispiel #16
0
 /**
  * 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;
 }
Beispiel #17
0
 public function init()
 {
     // Set the custom decorator
     $this->addElementPrefixPath('Shineisp_Decorator', 'Shineisp/Decorator/', 'decorator');
     $translate = Shineisp_Registry::get('Zend_Translate');
     /*
      * This hidden form field will be converted in a advanced select object
      * the JQuery Select2 object is loaded automatically by the css class select2
      */
     $this->addElement('hidden', 'customer_id', array('filters' => array('StringTrim'), 'required' => true, 'label' => $translate->_('Customer'), 'decorators' => array('Bootstrap'), 'field-id' => "customer_id", 'fields-data' => "lastname firstname ( company )", 'url-search' => "/admin/customers/search", 'class' => 'select2'));
     /*
      * This hidden form field will be converted in a advanced select object
      * the JQuery Select2 object is loaded automatically by the css class select2
      */
     $this->addElement('hidden', 'customer_parent_id', array('label' => $translate->_('Invoice destination'), 'decorators' => array('Bootstrap'), 'field-id' => "customer_id", 'fields-data' => "firstname lastname", 'url-search' => "/admin/customers/search", 'class' => 'select2', 'disable' => 'true'));
     $this->addElement('select', 'isp_id', array('required' => true, 'label' => $translate->_('ISP'), 'decorators' => array('Bootstrap'), 'class' => 'form-control'));
     $this->getElement('isp_id')->setAllowEmpty(false)->setMultiOptions(Isp::getList());
     /*
      * This hidden form field will be converted in a advanced select object
      * the JQuery Select2 object is loaded automatically by the css class select2
      */
     $this->addElement('hidden', 'categories', array('label' => $translate->_('Filter by categories'), 'decorators' => array('Bootstrap'), 'id' => 'productcategories', 'field-id' => "category_id", 'fields-data' => "name", 'url-search' => "/admin/productscategories/search", 'class' => 'select2', 'rel' => 'tree_select'));
     /*
      * This hidden form field will be converted in a advanced select object
      * the JQuery Select2 object is loaded automatically by the css class select2
      */
     $this->addElement('hidden', 'referdomain', array('filters' => array('StringTrim'), 'label' => $translate->_('Reference Domain'), 'description' => $translate->_('Assign a domain in order to identify the service/product'), 'decorators' => array('Bootstrap'), 'field-id' => "domain_id", 'fields-data' => "domain", 'url-search' => "/admin/domains/search", 'class' => 'select2'));
     /* 
      * This hidden form field will be converted in a advanced select object
      * the JQuery Select2 object is loaded automatically by the css class select2
      */
     $this->addElement('hidden', 'products', array('id' => "products", 'required' => false, 'label' => $translate->_('Products'), 'field-id' => "product_id", 'fields-data' => "name", 'url-search' => "/admin/products/search", 'class' => 'select2'));
     /*
      * This hidden form field will be converted in a advanced select object
      * the JQuery Select2 object is loaded automatically by the css class select2
      */
     $this->addElement('hidden', 'billingcycle_id', array('id' => 'billingid', 'label' => $translate->_('Billing Cycle'), 'decorators' => array('Bootstrap'), 'field-id' => "billing_cycle_id", 'fields-data' => "name ( price /  setupfee )", 'url-search' => "/admin/orders/getbillingcycles", 'class' => 'select2'));
     /*
      * This hidden form field will be converted in a advanced select object
      * the JQuery Select2 object is loaded automatically by the css class select2
      */
     $this->addElement('hidden', 'domains_selected', array('filters' => array('StringTrim'), 'label' => $translate->_('Add Domains'), 'decorators' => array('Bootstrap'), 'description' => $translate->_('If you do not find a domain name from this list, you have to create it by the domain admministration page.'), 'multiple' => true, 'field-id' => "domain_id", 'fields-data' => "domain", 'url-search' => "/admin/domains/search", 'class' => 'select2'));
     $this->addElement('checkbox', 'is_renewal', array('label' => $translate->_('Is a Renewal?'), 'description' => "If this order is a renewal, it will be checked by ShineISP and it cannot be deleted by the customer in the customer order frontend panel.", 'decorators' => array('Bootstrap'), 'class' => 'form-control'));
     /*
      * This hidden form field will be converted in a advanced select object
      * the JQuery Select2 object is loaded automatically by the css class select2
      */
     $this->addElement('hidden', 'invoice_id', array('label' => $translate->_('Invoice No.'), 'decorators' => array('Bootstrap'), 'field-id' => "invoice_id", 'fields-data' => "formatted_number ( number )", 'url-search' => "/admin/invoices/search", 'class' => 'select2'));
     $this->addElement('text', 'order_date', array('filters' => array('StringTrim'), 'label' => $translate->_('Order Date'), 'decorators' => array('Bootstrap'), 'class' => 'form-control date', 'dateformat' => Settings::getJsDateFormat()));
     $this->addElement('text', 'expiring_date', array('filters' => array('StringTrim'), 'label' => $translate->_('Expiry Date'), 'description' => $translate->_('If this date is set ShineISP will suspend the order at the specified date.'), 'decorators' => array('Bootstrap'), 'class' => 'form-control date', 'dateformat' => Settings::getJsDateFormat()));
     $this->addElement('text', 'date_start', array('filters' => array('StringTrim'), 'label' => $translate->_('Date Start'), 'decorators' => array('Bootstrap'), 'class' => 'form-control date', 'dateformat' => Settings::getJsDateFormat()));
     $this->addElement('text', 'quantity', array('filters' => array('StringTrim'), 'label' => $translate->_('Quantity'), 'decorators' => array('Bootstrap'), 'value' => '1', 'class' => 'form-control'));
     $this->addElement('text', 'profit', array('filters' => array('StringTrim'), 'label' => $translate->_('Profit'), 'decorators' => array('Bootstrap'), 'class' => 'form-control'));
     $this->addElement('textarea', 'description', array('filters' => array('StringTrim'), 'label' => $translate->_('Description'), 'id' => 'description', 'rows' => '3', 'decorators' => array('Bootstrap'), 'class' => 'col-lg-12 form-control'));
     $this->addElement('text', 'cost', array('filters' => array('StringTrim'), 'label' => $translate->_('Cost'), 'decorators' => array('Bootstrap'), 'class' => 'form-control'));
     $this->addElement('text', 'price', array('filters' => array('StringTrim'), 'label' => $translate->_('Price'), 'id' => 'price', 'decorators' => array('Bootstrap'), 'class' => 'form-control'));
     $this->addElement('text', 'setupfee', array('filters' => array('StringTrim'), 'label' => $translate->_('Setup fee'), 'decorators' => array('Bootstrap'), 'class' => 'form-control'));
     $this->addElement('text', 'vat', array('filters' => array('StringTrim'), 'label' => $translate->_('VAT'), 'decorators' => array('Bootstrap'), 'class' => 'form-control'));
     $this->addElement('text', 'total', array('filters' => array('StringTrim'), 'label' => $translate->_('Total'), 'decorators' => array('Bootstrap'), 'class' => 'form-control'));
     $this->addElement('text', 'grandtotal', array('filters' => array('StringTrim'), 'label' => $translate->_('Grand Total'), 'decorators' => array('Bootstrap'), 'description' => $translate->_('Save again in order to update the totals.'), 'class' => 'form-control bold'));
     $this->addElement('text', 'received_income', array('readonly' => 1, 'filters' => array('StringTrim'), 'label' => $translate->_('Income'), 'decorators' => array('Bootstrap'), 'class' => 'form-control'));
     $this->addElement('text', 'missing_income', array('readonly' => 1, 'filters' => array('StringTrim'), 'label' => $translate->_('Missing income'), 'decorators' => array('Bootstrap'), 'class' => 'form-control'));
     $this->addElement('text', 'fastlink', array('filters' => array('StringTrim'), 'id' => 'fastlink', 'label' => $translate->_('Fastlink Code'), 'decorators' => array('Bootstrap'), 'description' => $translate->_('Here you can read a unique code for redirect a user in the order page using the fastlink.'), 'class' => 'form-control readonly'));
     $this->addElement('text', 'visits', array('filters' => array('StringTrim'), 'label' => $translate->_('Visits'), 'decorators' => array('Bootstrap'), 'description' => $translate->_('Here you can read how many times the order has been viewed by the customer.'), 'class' => 'form-control readonly'));
     // If the browser client is an Apple client hide the file upload html object
     if (false == Shineisp_Commons_Utilities::isAppleClient()) {
         $MBlimit = Settings::findbyParam('adminuploadlimit');
         $Byteslimit = Shineisp_Commons_Utilities::MB2Bytes($MBlimit);
         $filetypes = Settings::findbyParam('adminuploadfiletypes', 'Admin');
         $file = $this->createElement('file', 'attachments', array('label' => $translate->_('Attachment'), 'decorators' => array('File', array('ViewScript', array('viewScript' => 'partials/file.phtml', 'placement' => false))), 'description' => $translate->_('Select the document to upload. Files allowed are (%s) - Max %s', $filetypes, Shineisp_Commons_Utilities::formatSizeUnits($Byteslimit)), 'data-classButton' => 'btn btn-primary', 'data-input' => 'false', 'class' => 'filestyle'));
         if (!empty($filetypes)) {
             $file->addValidator('Extension', false, $filetypes);
         }
         $file->addValidator('Size', false, $Byteslimit)->addValidator('Count', false, 1);
         $this->addElement($file);
         $this->addElement('select', 'filecategory', array('label' => $translate->_('Category'), 'decorators' => array('Bootstrap'), 'class' => 'form-control'));
         $this->getElement('filecategory')->setAllowEmpty(false)->setMultiOptions(FilesCategories::getList())->setRegisterInArrayValidator(false)->setRequired(false);
     }
     $this->addElement('textarea', 'note', array('filters' => array('StringTrim'), 'label' => $translate->_('Private Notes'), 'decorators' => array('Bootstrap'), 'class' => 'col-lg-12 form-control wysiwyg'));
     $this->addElement('textarea', 'message', array('filters' => array('StringTrim'), 'label' => $translate->_('Post a comment'), 'decorators' => array('Bootstrap'), 'class' => 'form-control wysiwyg'));
     $this->addElement('select', 'status_id', array('label' => 'Status', 'required' => true, 'decorators' => array('Bootstrap'), 'class' => 'form-control'));
     $this->getElement('status_id')->setAllowEmpty(false)->setMultiOptions(Statuses::getList('orders'));
     $this->addElement('text', 'paymentdate', array('filters' => array('StringTrim'), 'label' => $translate->_('Payment date'), 'decorators' => array('Bootstrap'), 'class' => 'form-control date'));
     $this->addElement('text', 'reference', array('filters' => array('StringTrim'), 'label' => $translate->_('Payment Reference'), 'decorators' => array('Bootstrap'), 'class' => 'form-control'));
     $this->addElement('select', 'bank_id', array('id' => 'paymentmethods', 'label' => $translate->_('Bank name'), 'decorators' => array('Bootstrap'), 'class' => 'form-control'));
     $this->getElement('bank_id')->setAllowEmpty(false)->setMultiOptions(Banks::getList(true));
     $this->addElement('text', 'income', array('filters' => array('StringTrim'), 'label' => $translate->_('Income'), 'decorators' => array('Bootstrap'), 'class' => 'form-control'));
     $this->addElement('text', 'payment_description', array('filters' => array('StringTrim'), 'label' => $translate->_('Notes'), 'decorators' => array('Bootstrap'), 'class' => 'form-control'));
     $this->addElement('select', 'confirmed', array('filters' => array('StringTrim'), 'label' => $translate->_('Has the Transaction been confirmed?'), 'decorators' => array('Bootstrap'), 'class' => 'form-control'));
     $this->getElement('confirmed')->setAllowEmpty(false)->setMultiOptions(array('0' => "No, not yet", '1' => "Yes, it has been"));
     $this->addElement('hidden', 'order_id');
 }
Beispiel #18
0
 /**
  * export the content in a pdf file
  * @param array $items
  */
 public function bulk_export($items)
 {
     $isp = Isp::getActiveISP();
     $pdf = new Shineisp_Commons_PdfList();
     $translator = Shineisp_Registry::getInstance()->Zend_Translate;
     // Get the records from the domains table
     $domains = self::get_domains($items, "d.domain_id, \r\n\t\t\t\t\t\t\t\t\t\t\t  CONCAT(d.domain, '.', d.tld) as domain, \r\n\t\t\t\t\t\t\t\t\t\t\t  DATE_FORMAT(d.creation_date, '" . Settings::getMySQLDateFormat('dateformat') . "') as creation_date, \r\n\t\t\t\t\t\t\t\t\t\t\t  DATE_FORMAT(d.expiring_date, '" . Settings::getMySQLDateFormat('dateformat') . "') as expiring_date, , \r\n\t\t\t\t\t\t\t\t\t\t\t  DATEDIFF(expiring_date, CURRENT_DATE) as days,\r\n                       \t\t\t\t\t\t  IF(d.autorenew = 1, 'YES', 'NO') as renew,\r\n\t\t\t\t\t\t\t\t\t\t\t  s.status as status", "d.expiring_date, d.domain");
     // Create the PDF header
     $grid['headers']['title'] = $translator->translate('Domain Listing');
     $grid['headers']['subtitle'] = $translator->_("List of the domains since %s and sorted by the expiring date and domain name", date('d/m/Y H:i:s'));
     $grid['footer']['text'] = $isp['company'] . " - " . $isp['website'];
     if (!empty($domains[0])) {
         // Create the columns of the grid
         $grid['columns'][] = array("value" => $translator->translate('Domain'));
     }
     $grid['columns'][] = array("value" => $translator->translate('Creation Date'), 'size' => 80);
     $grid['columns'][] = array("value" => $translator->translate('Expiry Date'), 'size' => 80);
     $grid['columns'][] = array("value" => $translator->translate('Days'), 'size' => 80);
     $grid['columns'][] = array("value" => $translator->translate('Automatic Renewal'), 'size' => 80);
     $grid['columns'][] = array("value" => $translator->translate('Status'), 'size' => 80);
     // Getting the records values and delete the first column the customer_id field.
     foreach ($domains as $domain) {
         $values = array_values($domain);
         array_shift($values);
         $grid['records'][] = $values;
     }
     // Create the PDF
     die($pdf->create($grid));
     return false;
 }
Beispiel #19
0
 /**
  * Get the complete category menu
  * 
  */
 public static function getMenu()
 {
     $isp_id = Isp::getCurrentId();
     $categories = array();
     $dq = Doctrine_Query::create()->select('c.category_id as id, c.name, c.parent, c.uri, c.description, c.keywords')->from('ProductsCategories c')->where('c.enabled = ?', 1)->andWhere('c.show_in_menu = ?', 1)->andWhere('c.isp_id = ?', $isp_id)->orderBy('c.parent, c.position, c.name');
     $dq->addSelect('( SELECT COUNT( * ) FROM ProductsCategories pc WHERE pc.parent = c.category_id) as children');
     $records = $dq->execute(array(), Doctrine_Core::HYDRATE_ARRAY);
     if (!empty($records)) {
         foreach ($records as $category) {
             $total = self::countProducts($category['id']);
             if ($total) {
                 $categories[] = $category;
             }
         }
     }
     return $categories;
 }
Beispiel #20
0
 public static function getDnsserver()
 {
     $dq = Doctrine_Query::create()->from('Servers i')->leftJoin('i.Servers_Types st ON st.type_id = i.type_id')->where("type_id = ?", 4)->andWhere("isp_id = ?", Isp::getActiveISPID());
     return $dq->execute(array(), Doctrine_Core::HYDRATE_ARRAY);
 }
Beispiel #21
0
 /**
  * Get the related products starting 
  * by a specific product_id
  * excluding itself
  * 
  * @param integer $product_id
  */
 public static function get_products($product_id, $locale = "1")
 {
     $related = Doctrine_Query::create()->select("pr.related_id, p.product_id as product_id, p.uri as uri, p.price_1 as price, pd.name as name, pd.shortdescription as description, p.ishighlighted as ishighlighted")->from('ProductsRelated pr')->leftJoin('pr.Products p')->leftJoin("p.ProductsData pd WITH pd.language_id = {$locale}")->where('pr.product_id = ?', $product_id)->addWhere("p.product_id <> ?", $product_id)->addWhere("p.isp_id = ?", Isp::getCurrentId())->orderBy('p.group_id, p.position')->execute(array(), Doctrine_Core::HYDRATE_ARRAY);
     return $related;
 }
Beispiel #22
0
 /**
  * export the content in a pdf file
  * @param array $items
  */
 public function bulk_pdf_export($items)
 {
     $isp = Isp::getActiveISP();
     $pdf = new Shineisp_Commons_PdfList();
     $translator = Shineisp_Registry::getInstance()->Zend_Translate;
     // Get the records from the order table
     $orders = self::get_invoices($items, "invoice_id, number as num, order_id as orderid, DATE_FORMAT(invoice_date, '" . Settings::getMySQLDateFormat('dateformat') . "') as invoicedate, \n\t\tc.company as company, CONCAT(c.firstname, ' ', c.lastname) as fullname, o.total as total, o.vat as vat, o.grandtotal as grandtotal,", 'number, invoice_date');
     // Create the PDF header
     $grid['headers']['title'] = $translator->translate('Invoices Listing');
     $grid['headers']['subtitle'] = $translator->translate('Here you can see the invoices listing');
     $grid['footer']['text'] = $isp['company'] . " - " . $isp['website'];
     if (!empty($orders[0])) {
         $total = 0;
     }
     $vat = 0;
     $grandtotal = 0;
     // Create the columns of the grid
     $grid['columns'][] = array("value" => $translator->translate('Invoice'), 'size' => 50);
     $grid['columns'][] = array("value" => $translator->translate('Order'), 'size' => 50);
     $grid['columns'][] = array("value" => $translator->translate('Date'), 'size' => 100);
     $grid['columns'][] = array("value" => $translator->translate('Company'));
     $grid['columns'][] = array("value" => $translator->translate('Fullname'));
     $grid['columns'][] = array("value" => $translator->translate('Total'), 'size' => 50);
     $grid['columns'][] = array("value" => $translator->translate('VAT'), 'size' => 50);
     $grid['columns'][] = array("value" => $translator->translate('Grand Total'), 'size' => 50);
     // Getting the records values and delete the first column the customer_id field.
     foreach ($orders as $item) {
         $values = array_values($item);
         array_shift($values);
         $grid['records'][] = $values;
         $total += is_numeric($values[5]) ? $values[5] : 0;
         $vat += is_numeric($values[6]) ? $values[6] : 0;
         $grandtotal += is_numeric($values[7]) ? $values[7] : 0;
     }
     $grid['records'][] = array('', '', '', '', $translator->translate('Totals'), $total, $vat, $grandtotal);
     // Create the PDF
     die($pdf->create($grid));
     return false;
 }
Beispiel #23
0
 private function doDomainTask($task)
 {
     if (!isset($task['Domains']) || !isset($task['Domains']['Customers']) || !isset($task['Domains']['Customers']['customer_id'])) {
         PanelsActions::UpdateTaskLog($task['action_id'], $this->translations->translate('customer_id not found'));
     }
     $customer_id = intval($task['Domains']['Customers']['customer_id']);
     $ISP = Isp::getByCustomerId($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'));
         return false;
     }
     try {
         // Getting domains details
         $domain = Domains::find($task['domain_id'], null, true);
         if (!empty($domain[0])) {
             $domain_name = $domain[0]['domain'] . "." . $domain[0]['tld'];
             // Get the associated registrar for the domain selected
             $registrar = Registrars::getRegistrarId($task['registrars_id']);
             if (!empty($registrar['class'])) {
                 // Create the class registrar object
                 $class = $registrar['class'];
                 $regclass = new $class();
                 $action = $task['action'];
                 // Check if the task is REGISTER or TRANSFER the domain name
                 if ($action == "registerDomain") {
                     $regclass->registerDomain($task['domain_id']);
                     // Set the DNS ZONES
                     DomainsTasks::AddTask($domain_name, "setDomainHosts");
                     // Update the domain information
                     DomainsTasks::AddTask($domain_name, "updateDomain");
                 } elseif ($action == "transferDomain") {
                     $regclass->transferDomain($task['domain_id']);
                 } elseif ($action == "renewDomain") {
                     $regclass->renewDomain($task['domain_id']);
                     // Update the domain information
                     DomainsTasks::AddTask($domain_name, "updateDomain");
                 } elseif ($action == "lockDomain") {
                     $regclass->lockDomain($task['domain_id']);
                 } elseif ($action == "unlockDomain") {
                     $regclass->unlockDomain($task['domain_id']);
                     // Update the domain information
                     DomainsTasks::AddTask($domain_name, "updateDomain");
                 } elseif ($action == "setNameServers") {
                     $regclass->setNameServers($task['domain_id']);
                 } elseif ($action == "setDomainHosts") {
                     $regclass->setDomainHosts($task['domain_id']);
                 } else {
                     $regclass->{$action}($task['domain_id']);
                 }
                 // Update the log description of the task
                 DomainsTasks::UpdateTaskLog($task['task_id'], $this->translations->translate("Your request has been executed."));
                 // Update the status of the task
                 DomainsTasks::UpdateTaskStatus($task['task_id'], Statuses::id('complete', 'domains_tasks'));
                 // Set the task as "Complete"
                 // Increment the task counter number
                 DomainsTasks::UpdateTaskCounter($task['task_id']);
                 // Set the status as Active
                 Domains::setStatus($task['domain_id'], Statuses::id('active', 'domains_tasks'));
             }
         }
     } catch (Exception $e) {
         DomainsTasks::UpdateTaskLog($task['task_id'], $this->translations->translate($e->getMessage()));
         Shineisp_Commons_Utilities::SendEmail($ISP['email'], $ISP['email'], null, "Task error message: " . $task['Domains']['domain'] . "." . $task['Domains']['tld'], $e->getMessage());
         Shineisp_Commons_Utilities::logs("Task error message: " . $task['Domains']['domain'] . "." . $task['Domains']['tld'] . ":" . $e->getMessage(), "tasks.log");
     }
     return true;
 }
Beispiel #24
0
 /**
  * processAction
  * Update the record previously selected
  * @return unknown_type
  */
 public function processAction()
 {
     $request = $this->getRequest();
     // 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/isp/list", "label" => $this->translator->translate('List'), "params" => array('css' => null, 'id' => 'submit')), array("url" => "/admin/isp/new/", "label" => $this->translator->translate('New'), "params" => array('css' => null)));
     // Check if we have a POST request
     if (!$request->isPost()) {
         return $this->_helper->redirector('index');
     }
     // Get our form and validate it
     $form = $this->getForm('/admin/isp/process');
     if (!$form->isValid($request->getPost())) {
         // Invalid entries
         $this->view->form = $form;
         $this->view->title = $this->translator->translate("ISP Account");
         $this->view->description = $this->translator->translate("Some information must be checked again before saving them.");
         return $this->render('applicantform');
         // re-render the login form
     }
     // Save the data
     Isp::saveAll($request->getPost(), $this->isp['isp_id']);
     return $this->_helper->redirector('account', 'isp', 'admin');
 }
Beispiel #25
0
 /**
  * Get all highligted tlds records
  * 
  * 
  * @return Array
  */
 public static function getHighlighted($locale = 1)
 {
     $isp = Shineisp_Registry::get('ISP');
     try {
         $dq = Doctrine_Query::create()->from('DomainsTlds dt')->leftJoin("dt.DomainsTldsData dtd WITH dtd.language_id = {$locale}")->leftJoin('dt.Registrars r')->leftJoin('dt.Taxes t')->where('dt.ishighlighted = ?', true);
         if (!empty($isp)) {
             $dq->addWhere('dt.isp_id = ?', $isp->isp_id);
         } else {
             $dq->addWhere('dt.isp_id = ?', Isp::getActiveISPID());
         }
         return $dq->execute(array(), Doctrine_Core::HYDRATE_ARRAY);
     } catch (Exception $e) {
         die($e->getMessage());
     }
 }
Beispiel #26
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;
 }
Beispiel #27
0
 /**
  * export the content in a pdf file
  * @param array $items
  */
 public function bulk_export($items)
 {
     $isp = Isp::getActiveISP();
     $pdf = new Shineisp_Commons_PdfList();
     $translator = Shineisp_Registry::getInstance()->Zend_Translate;
     // Get the records from the payment table
     $orders = self::get_payments($items, "p.payment_id,\r\n\t\t\t\t\t\t\t\t\t\t\t  o.order_id as orderid,\r\n\t\t\t\t\t\t\t\t\t\t\t  o.order_date as orderdate,\r\n\t\t\t\t\t\t\t\t\t\t\t  i.number as invoice,\r\n                                              DATE_FORMAT(p.paymentdate, '" . Settings::getMySQLDateFormat('dateformat') . "') as paymentdate,\r\n                                              CONCAT(c.firstname, ' ', c.lastname, ' ', c.company) as customer,\r\n                                              CONCAT(r.firstname, ' ', r.lastname, ' ', r.company) as reseller,\r\n                                              p.reference as reference,\r\n                                              p.confirmed as confirmed,\r\n                                              p.income as income,\r\n                                              p.outcome as outcome,\r\n\t\t\t\t\t\t\t\t\t\t\t  o.grandtotal as grandtotal\r\n                                              ", 'o.order_date');
     // Create the PDF header
     $grid['headers']['title'] = $translator->translate('Payment Transaction Listing');
     $grid['headers']['subtitle'] = $translator->translate('List of the payment transactions');
     $grid['footer']['text'] = $isp['company'] . " - " . $isp['website'];
     if (!empty($orders[0])) {
         // Create the columns of the grid
         $grid['columns'][] = array("value" => $translator->translate('Payment'), 'size' => 50);
         $grid['columns'][] = array("value" => $translator->translate('Order'), 'size' => 50);
         $grid['columns'][] = array("value" => $translator->translate('Order Date'), 'size' => 50);
         $grid['columns'][] = array("value" => $translator->translate('Invoice'), 'size' => 100);
         $grid['columns'][] = array("value" => $translator->translate('Transaction Date'), 'size' => 100);
         $grid['columns'][] = array("value" => $translator->translate('Company'));
         $grid['columns'][] = array("value" => $translator->translate('Reseller'));
         $grid['columns'][] = array("value" => $translator->translate('Reference'));
         $grid['columns'][] = array("value" => $translator->translate('Confirmed'));
         $grid['columns'][] = array("value" => $translator->translate('Income'), 'size' => 50);
         $grid['columns'][] = array("value" => $translator->translate('Expense'), 'size' => 50);
         $grid['columns'][] = array("value" => $translator->translate('Grand Total'), 'size' => 50);
         // Getting the records values and delete the first column the customer_id field.
         foreach ($orders as $item) {
             $values = array_values($item);
             $grid['records'][] = $values;
         }
         // Create the PDF
         die($pdf->create($grid));
     }
     return false;
 }
Beispiel #28
0
 /**
  * Send the newsletter to the queue
  */
 public static function send_queue($test = FALSE, $id = NULL)
 {
     $queue = NewslettersHistory::get_active_queue($test, $id);
     $isp = Isp::getActiveISP();
     try {
         // Get the template from the main email template folder
         $retval = Shineisp_Commons_Utilities::getEmailTemplate('newsletter');
         if (!empty($retval) && !empty($queue)) {
             $contents = Newsletters::fill_content();
             $subject = $retval['subject'];
             $template = $retval['template'];
             $subject = str_replace("[subject]", $queue[0]['Newsletters']['subject'], $subject);
             $template = str_replace("[subject]", $queue[0]['Newsletters']['subject'], $template);
             $template = str_replace("[body]", $queue[0]['Newsletters']['message'], $template);
             foreach ($contents as $name => $content) {
                 $template = str_replace("[" . $name . "]", $content, $template);
             }
             foreach ($isp as $field => $value) {
                 $template = str_replace("[" . $field . "]", $value, $template);
             }
             $template = str_replace("[url]", "http://" . $_SERVER['HTTP_HOST'] . "/media/newsletter/", $template);
             foreach ($queue as $item) {
                 // Send a test of the newsletter to the default isp email otherwise send an email to the queue
                 if ($test) {
                     $body = str_replace("[optout]", "#", $template);
                     Shineisp_Commons_Utilities::SendEmail($isp['email'], $isp['email'], null, "<!--TEST --> " . $subject, $body, true);
                     break;
                 } else {
                     // Create the optout link to be added in the email
                     $body = str_replace("[optout]", '<a href="http://' . $_SERVER['HTTP_HOST'] . "/newsletter/optout/id/" . MD5($item['NewslettersSubscribers']['email']) . '" >Unsubscribe</a>', $template);
                     $result = Shineisp_Commons_Utilities::SendEmail($isp['email'], $item['NewslettersSubscribers']['email'], null, $subject, $body, true);
                     if ($result === true) {
                         NewslettersHistory::set_status($item['subscriber_id'], $item['newsletter_id'], 1, "Mail Sent");
                     } else {
                         NewslettersHistory::set_status($item['subscriber_id'], $item['newsletter_id'], 0, $result['message']);
                     }
                     Newsletters::set_sending_date($item['news_id']);
                 }
             }
         }
     } catch (Exception $e) {
         echo $e->getMessage();
         return false;
     }
     return true;
 }
Beispiel #29
0
 /**
  * export the content in a excel file
  * @param array $items
  */
 public function bulk_excel($items)
 {
     if (empty($items)) {
         return false;
     }
     $objPHPExcel = new PHPExcel();
     $company = Isp::getActiveISP();
     $translator = Shineisp_Registry::getInstance()->Zend_Translate;
     $objPHPExcel->getProperties()->setCreator($company['company']);
     $objPHPExcel->getProperties()->setLastModifiedBy($company['manager']);
     $objPHPExcel->getProperties()->setTitle("Office 2007 XLSX __CLASS__ Document");
     $objPHPExcel->getProperties()->setSubject("Office 2007 XLSX __CLASS__ Document");
     $objPHPExcel->setActiveSheetIndex(0);
     // Get the records from the customer table
     $data = self::get_customers($items);
     // Create the PDF header
     $objPHPExcel->getActiveSheet()->setTitle($translator->translate('Customer List'));
     $objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow(0, 1, strtoupper($translator->translate('Customer List')));
     if (!empty($data[0])) {
         $row = 4;
         $column = 0;
         // Fields header title
         $objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow($column, 3, $translator->translate('Id'));
         $objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow($column++, 3, $translator->translate('Company'));
         $objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow($column++, 3, $translator->translate('Firstname'));
         $objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow($column++, 3, $translator->translate('Lastname'));
         $objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow($column++, 3, $translator->translate('Gender'));
         $objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow($column++, 3, $translator->translate('Email'));
         $objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow($column++, 3, $translator->translate('Password'));
         $objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow($column++, 3, $translator->translate('Birth Date'));
         $objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow($column++, 3, $translator->translate('Birth Place'));
         $objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow($column++, 3, $translator->translate('Birth District'));
         $objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow($column++, 3, $translator->translate('Birth Country'));
         $objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow($column++, 3, $translator->translate('Birth Nationality'));
         $objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow($column++, 3, $translator->translate('Tax Payer Number'));
         $objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow($column++, 3, $translator->translate('VAT'));
         $objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow($column++, 3, $translator->translate('Company Type'));
         $objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow($column++, 3, $translator->translate('Legal form'));
         $objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow($column++, 3, $translator->translate('Note'));
         $objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow($column++, 3, $translator->translate('Status'));
         $objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow($column++, 3, $translator->translate('Group'));
         $objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow($column++, 3, $translator->translate('Language'));
         $objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow($column++, 3, $translator->translate('Newsletter'));
         $objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow($column++, 3, $translator->translate('Creation Date'));
         $objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow($column++, 3, $translator->translate('Upload Date'));
         $objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow($column++, 3, $translator->translate('Tax Free'));
         $objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow($column++, 3, $translator->translate('Address'));
         $objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow($column++, 3, $translator->translate('City'));
         $objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow($column++, 3, $translator->translate('Code'));
         $objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow($column++, 3, $translator->translate('Country'));
         $objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow($column++, 3, $translator->translate('Area'));
         $column = 0;
         // Get the main information of the client
         foreach ($data as $item) {
             $objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow($column, $row, $item['customer_id']);
             $objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow($column++, $row, $item['company']);
             $objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow($column++, $row, $item['firstname']);
             $objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow($column++, $row, $item['lastname']);
             $objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow($column++, $row, $item['gender']);
             $objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow($column++, $row, $item['email']);
             $objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow($column++, $row, $item['password']);
             $objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow($column++, $row, $item['birthdate']);
             $objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow($column++, $row, $item['birthplace']);
             $objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow($column++, $row, $item['birthdistrict']);
             $objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow($column++, $row, $item['birthcountry']);
             $objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow($column++, $row, $item['birthnationality']);
             $objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow($column++, $row, $item['taxpayernumber']);
             $objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow($column++, $row, $item['vat']);
             $objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow($column++, $row, $item['CompanyTypes']['name']);
             $objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow($column++, $row, $item['Legalforms']['name']);
             $objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow($column++, $row, $item['note']);
             $objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow($column++, $row, $item['Statuses']['status']);
             $objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow($column++, $row, $item['CustomersGroups']['name']);
             $objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow($column++, $row, $item['issubscriber']);
             $objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow($column++, $row, $item['created_at']);
             $objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow($column++, $row, $item['updated_at']);
             $objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow($column++, $row, $item['taxfree']);
             // get all the addresses
             foreach ($item['Addresses'] as $address) {
                 $objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow($column++, $row, $address['address']);
                 $objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow($column++, $row, $address['city']);
                 $objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow($column++, $row, $address['code']);
                 $objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow($column++, $row, $address['Countries']['name']);
                 $objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow($column++, $row, $address['area']);
                 break;
             }
             // get all the contacts
             foreach ($item['Contacts'] as $contact) {
                 $objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow($column, 3, $translator->translate($contact['ContactsTypes']['name']));
                 $objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow($column++, $row, $contact['contact']);
                 break;
             }
             $row++;
             $column = 0;
         }
     }
     // Create the XLS
     $objWriter = new PHPExcel_Writer_Excel2007($objPHPExcel);
     $objWriter->save(PUBLIC_PATH . "/tmp/" . __CLASS__ . '.xlsx');
     die(json_encode(array('url' => "/tmp/" . __CLASS__ . ".xlsx")));
 }
Beispiel #30
0
 /**
  * export the content in a pdf file
  * @param array $items
  */
 public function bulk_export($items)
 {
     $isp = Isp::getActiveISP();
     $pdf = new Shineisp_Commons_PdfList();
     $translator = Shineisp_Registry::getInstance()->Zend_Translate;
     // Get the records from the reviews table
     $reviews = self::get_reviews($items, "review_id, nick, subject, review");
     // Create the PDF header
     $grid['headers']['title'] = $translator->translate('Product Reviews List');
     $grid['headers']['subtitle'] = $translator->translate('List of the product reviews.');
     $grid['footer']['text'] = $isp['company'] . " - " . $isp['website'];
     if (!empty($reviews[0])) {
         // Create the columns of the grid
         $grid['columns'][] = array("value" => $translator->translate('Nick'), 'size' => 100);
     }
     $grid['columns'][] = array("value" => $translator->translate('Subject'), 'size' => 100);
     $grid['columns'][] = array("value" => $translator->translate('review'));
     // Getting the records values and delete the first column the customer_id field.
     foreach ($reviews as $item) {
         $values = array_values($item);
         array_shift($values);
         $grid['records'][] = $values;
     }
     // Create the PDF
     die($pdf->create($grid));
     return false;
 }