Exemple #1
0
 public function init()
 {
     $NS = new Zend_Session_Namespace('Default');
     $translate = Shineisp_Registry::get('Zend_Translate');
     // Set the custom decorator
     $this->addElementPrefixPath('Shineisp_Decorator', 'Shineisp/Decorator/', 'decorator');
     $this->addElement('select', 'domain_id', array('decorators' => array('Bootstrap'), 'required' => false, 'label' => $translate->_('Domain'), 'description' => $translate->_('Choose the domain name reference'), 'class' => 'form-control large-input'));
     $this->getElement('domain_id')->setAllowEmpty(false)->setRegisterInArrayValidator(false)->setMultiOptions(Domains::getList(true, $NS->customer['customer_id']));
     $this->addElement('text', 'subject', array('filters' => array('StringTrim'), 'required' => false, 'decorators' => array('Bootstrap'), 'title' => $translate->_('Write here a subject of the issue.'), 'label' => $translate->_('Subject'), 'description' => $translate->_('Write here the domain name or a simple description of the problem.'), 'class' => 'form-control large-input'));
     $this->addElement('textarea', 'note', array('filters' => array('StringTrim'), 'label' => $translate->_('Body Message'), 'decorators' => array('Bootstrap'), 'description' => $translate->_('Write here all the information.'), 'rows' => '8', 'class' => 'form-control wysiwyg-simple'));
     $this->addElement('select', 'status', array('filters' => array('StringTrim'), 'label' => $translate->_('Set the issue status'), 'decorators' => array('Bootstrap'), 'class' => 'form-control large-input', 'multioptions' => array('' => '', Statuses::id("solved", "tickets") => $translate->_('Solved'), Statuses::id("closed", "tickets") => $translate->_('Closed'))));
     $this->addElement('select', 'category_id', array('decorators' => array('Bootstrap'), 'label' => $translate->_('Category'), 'description' => 'Select a category.', 'class' => 'form-control large-input'));
     $this->getElement('category_id')->setAllowEmpty(false)->setRegisterInArrayValidator(false)->setMultiOptions(TicketsCategories::getList(true));
     if (false == Shineisp_Commons_Utilities::isAppleClient()) {
         $MBlimit = Settings::findbyParam('useruploadlimit');
         $Types = Settings::findbyParam('useruploadfiletypes');
         if (empty($MBlimit)) {
             $MBlimit = 1;
         }
         if (empty($Types)) {
             $Types = "zip,jpg";
         }
         $Byteslimit = Shineisp_Commons_Utilities::MB2Bytes($MBlimit);
         $file = $this->createElement('file', 'attachments', array('label' => $translate->_('Attachment'), 'description' => $translate->_('Select the document to upload. Files allowed are (%s) - Max %s', $Types, Shineisp_Commons_Utilities::formatSizeUnits($Byteslimit))));
         $file->addValidator('Extension', false, $Types)->addValidator('Size', false, $Byteslimit)->addValidator('Count', false, 1);
         $this->addElement($file);
     } else {
         $this->addElement('hidden', 'attachments');
     }
     $this->addElement('submit', 'submit', array('label' => $translate->_('Send help request'), 'decorators' => array('Bootstrap'), 'class' => 'btn btn-primary btn-lg'));
     $this->addElement('hidden', 'ticket_id');
 }
Exemple #2
0
 public function init()
 {
     // Set the custom decorator
     $this->addElementPrefixPath('Shineisp_Decorator', 'Shineisp/Decorator/', 'decorator');
     $translate = Shineisp_Registry::get('Zend_Translate');
     $this->addElement('text', 'subject', array('filters' => array('StringTrim'), 'required' => false, 'decorators' => array('Bootstrap'), 'label' => $translate->_('Subject'), 'class' => 'form-control'));
     $this->addElement('text', 'datetime', array('filters' => array('StringTrim'), 'label' => $translate->_('Date'), 'decorators' => array('Bootstrap'), 'class' => 'form-control'));
     $this->addElement('textarea', 'note', array('filters' => array('StringTrim'), 'class' => 'col-lg-12 form-control wysiwyg'));
     $this->addElement('select', 'sendemail', array('label' => $translate->_('Send Email'), 'description' => $translate->_('Send an email to the customer.'), 'decorators' => array('Bootstrap'), 'class' => 'form-control', 'multioptions' => array('1' => $translate->_('Yes'), '0' => $translate->_('No'))));
     $this->addElement('select', 'category_id', array('decorators' => array('Bootstrap'), 'label' => $translate->_('Category'), 'class' => 'form-control'));
     $this->getElement('category_id')->setAllowEmpty(false)->setRegisterInArrayValidator(false)->setMultiOptions(TicketsCategories::getList());
     $this->addElement('select', 'customer_id', array('decorators' => array('Bootstrap'), 'label' => $translate->_('Customer'), 'class' => 'form-control'));
     $this->getElement('customer_id')->setAllowEmpty(false)->setRegisterInArrayValidator(false)->setMultiOptions(Customers::getList());
     $this->addElement('select', 'category', array('decorators' => array('Bootstrap'), 'label' => $translate->_('Category'), 'class' => 'form-control'));
     $this->getElement('category')->setAllowEmpty(false)->setRegisterInArrayValidator(false)->setMultiOptions(TicketsCategories::getList());
     $this->addElement('select', 'order_id', array('decorators' => array('Bootstrap'), 'label' => $translate->_('Order reference'), 'class' => 'form-control'));
     $this->getElement('order_id')->setAllowEmpty(false)->setRegisterInArrayValidator(false)->setMultiOptions(Orders::getList(true));
     $this->addElement('select', 'sibling_id', array('decorators' => array('Bootstrap'), 'label' => $translate->_('Relationships'), 'class' => 'form-control'));
     $this->getElement('sibling_id')->setAllowEmpty(false)->setRegisterInArrayValidator(false);
     $this->addElement('select', 'user_id', array('decorators' => array('Bootstrap'), 'label' => $translate->_('Operator'), 'class' => 'form-control'));
     $this->getElement('user_id')->setAllowEmpty(false)->setRegisterInArrayValidator(false)->setMultiOptions(AdminUser::getList());
     #->setMultiOptions(AdminUser::getUserbyRoleID(AdminRoles::getIdRoleByName('operator')));
     $this->addElement('select', 'status_id', array('decorators' => array('Bootstrap'), 'label' => $translate->_('Status'), 'class' => 'form-control'));
     $this->getElement('status_id')->setAllowEmpty(false)->setRegisterInArrayValidator(false)->setMultiOptions(Statuses::getList('tickets'));
     // If the browser client is an Apple client hide the file upload html object
     if (false == Shineisp_Commons_Utilities::isAppleClient()) {
         $MBlimit = Settings::findbyParam('adminuploadlimit');
         $Types = Settings::findbyParam('adminuploadfiletypes', 'Admin');
         if (empty($MBlimit)) {
             $MBlimit = 1;
         }
         if (empty($Types)) {
             $Types = "zip,jpg";
         }
         $Byteslimit = Shineisp_Commons_Utilities::MB2Bytes($MBlimit);
         $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', $Types, Shineisp_Commons_Utilities::formatSizeUnits($Byteslimit)), 'data-classButton' => 'btn btn-primary', 'data-input' => 'false', 'class' => 'filestyle'));
         $file->addValidator('Extension', false, $Types)->addValidator('Size', false, $Byteslimit)->addValidator('Count', false, 1);
         $this->addElement($file);
     } else {
         $this->addElement('hidden', 'attachments');
     }
     $this->addElement('hidden', 'ticket_id');
 }
Exemple #3
0
 /**
  * editAction
  * Get a record and populate the application form 
  * @return unknown_type
  */
 public function editAction()
 {
     $form = $this->getForm('/admin/tickets/process');
     $id = $this->getRequest()->getParam('id');
     $this->view->title = $this->translator->translate("Edit Ticket");
     $this->view->description = $this->translator->translate("Here you can handle the ticket support.");
     // 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/tickets/list/", "label" => $this->translator->translate('List'), "params" => array('css' => null, 'id' => 'submit')), array("url" => "/admin/tickets/new/", "label" => $this->translator->translate('New'), "params" => array('css' => null)));
     if (!empty($id) && is_numeric($id)) {
         $this->view->buttons[] = array("url" => "/admin/tickets/setstatus/id/{$id}/statusid/" . Statuses::id('closed', 'tickets'), "label" => $this->translator->translate('Set as closed'), "params" => array('css' => array('btn btn-primary')));
         $this->view->buttons[] = array("url" => "/admin/tickets/setstatus/id/{$id}/statusid/" . Statuses::id('solved', 'tickets'), "label" => $this->translator->translate('Set as solved'), "params" => array('css' => array('btn btn-success')));
         $this->view->buttons[] = array("url" => "/admin/tickets/confirm/id/{$id}", "label" => $this->translator->translate('Delete'), "params" => array('css' => array('btn btn-danger')));
         $form->populate(array('datetime' => date('d/m/Y H:i:s'), 'ticket_id' => $id));
         $fields = "DATE_FORMAT(t.date_open, '%d/%m/%Y') as date_open, user_id, sibling_id, category_id as category, CONCAT(d.domain, '.', ws.tld) as domain, DATE_FORMAT(t.date_close, '%d/%m/%Y') as date_close, t.subject, t.description, t.status_id, s.status, c.email as email, c.customer_id as customer_id, CONCAT(c.firstname, ' ', c.lastname) as fullname, c.company as company, (DATEDIFF(t.date_close, t.date_open)) as days";
         $rs = $this->tickets->getAllInfo($id, $fields, true);
         if (!empty($rs[0])) {
             $form->populate(array('datetime' => date('d/m/Y H:i:s'), 'ticket_id' => $id) + $rs[0]);
             $siblings = Tickets::getListbyCustomerId($rs[0]['customer_id'], true, true);
             unset($siblings[$id]);
             $form->getElement('sibling_id')->setMultiOptions($siblings);
             if (!empty($rs[0]['sibling_id'])) {
                 $rs[0]['sibling'] = $this->tickets->getAllInfo($rs[0]['sibling_id'], $fields, true);
             }
             $this->view->record = $rs[0];
             $this->view->siblings = $siblings;
             $this->view->customerid = $rs[0]['customer_id'];
             $isp = Isp::getActiveISP();
             $this->view->customeravatar = Shineisp_Commons_Gravatar::get_gravatar($rs[0]['email'], 50);
             $this->view->notes = Tickets::Notes($id, "c.customer_id, tn.note_id, t.ticket_id, note_id as id, admin as adminreply, DATE_FORMAT(date_post, '%d/%m/%Y %H:%i:%s') as date_post, note as reply", true);
             // Header Information
             $this->view->title = "Edit Ticket: " . $rs[0]['subject'];
             $userlink = "<a href='/admin/customers/edit/id/" . $rs[0]['customer_id'] . "'>" . $rs[0]['fullname'] . "</a>";
             if (!empty($rs[0]['company'])) {
                 $userlink .= " [<a href='/admin/customers/edit/id/" . $rs[0]['customer_id'] . "'>" . $rs[0]['company'] . "</a>]";
             }
             $description[] = $this->translator->_("Support Ticket from %s", $userlink);
             $description[] = TicketsCategories::getName($rs[0]['category']);
             $description[] = $this->translator->_("Opened on %s", $rs[0]['date_open']);
             if (!empty($rs[0]['date_close'])) {
                 $description[] = $this->translator->_("Closed on %s", $rs[0]['date_close']);
             }
             if (!empty($rs[0]['domain'])) {
                 $description[] = "<a target=\"blank\" href=\"http://www." . $rs[0]['domain'] . "\">" . $rs[0]['domain'] . "</a>";
             }
             $this->view->description = implode(" - ", $description);
             // Hide these fields and values inside the vertical grid object
             unset($rs[0]['parent']);
             unset($rs[0]['description']);
             $this->view->data = array('records' => $rs);
         }
     }
     $this->view->form = $form;
     $this->render('applicantform');
 }
 /**
  * searchProcessAction
  * Search the record 
  * @return unknown_type
  */
 public function searchprocessAction()
 {
     $this->_helper->ajaxgrid->setConfig(TicketsCategories::grid())->search();
 }
 public function loadModel($id)
 {
     $model = TicketsCategories::model()->findByPk($id);
     if (!$model) {
         throw new CHttpException(404, 'The requested page does not exist.');
     }
     return $model;
 }
Exemple #6
0
    <?php 
echo $form->errorSummary($model);
?>

    <?php 
$this->widget('app.widgets.FlashMessages.FlashMessages');
?>

    <div class="form-group clearfix">
        <?php 
echo $form->labelEx($model, 'category_id', array('class' => 'col-lg-3 control-label'));
?>
        <div class="field">
            <?php 
echo $form->dropDownList($model, 'category_id', CHtml::listData(TicketsCategories::model()->opened()->findAll(), 'id', 'title'), array('class' => 'form-control'));
?>
        </div>
    </div>
    <div class="form-group clearfix">
        <?php 
echo $form->labelEx($model, 'priority', array('class' => 'col-lg-3 control-label'));
?>
        <div class="field">
            <?php 
echo $form->dropDownList($model, 'priority', $ticketModel->getPrioritiesList(), array('class' => 'form-control'));
?>
        </div>
    </div>
    <div class="form-group clearfix">
        <?php