當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Shineisp_Commons_Utilities::formatDateIn方法代碼示例

本文整理匯總了PHP中Shineisp_Commons_Utilities::formatDateIn方法的典型用法代碼示例。如果您正苦於以下問題:PHP Shineisp_Commons_Utilities::formatDateIn方法的具體用法?PHP Shineisp_Commons_Utilities::formatDateIn怎麽用?PHP Shineisp_Commons_Utilities::formatDateIn使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Shineisp_Commons_Utilities的用法示例。


在下文中一共展示了Shineisp_Commons_Utilities::formatDateIn方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: saveAll

 /**
  * Save all the data in the database
  * @param array $data
  * @param integer $id
  */
 public static function saveAll(array $data, $id = null)
 {
     if (!empty($data) && is_array($data)) {
         if (is_numeric($id)) {
             $profile = Doctrine::getTable('DomainsProfiles')->find($id);
             if ($profile->profile_id != $id) {
                 return false;
             }
         } else {
             $profile = new DomainsProfiles();
             $profile['created_at'] = date('Y-m-d h:i:s');
         }
         $profile['customer_id'] = $data['customer_id'];
         $profile['company'] = $data['company'];
         $profile['firstname'] = $data['firstname'];
         $profile['lastname'] = $data['lastname'];
         $profile['gender'] = $data['gender'];
         $profile['email'] = $data['email'];
         $profile['phone'] = $data['phone'];
         $profile['fax'] = $data['fax'];
         $profile['birthplace'] = $data['birthplace'];
         $profile['birthdate'] = Shineisp_Commons_Utilities::formatDateIn($data['birthdate']);
         $profile['birthdistrict'] = $data['birthdistrict'];
         $profile['birthcountry'] = $data['birthcountry'];
         $profile['birthnationality'] = $data['birthnationality'];
         $profile['address'] = $data['address'];
         $profile['zip'] = $data['zip'];
         $profile['city'] = $data['city'];
         $profile['area'] = $data['area'];
         $profile['country_id'] = !empty($data['country_id']) ? $data['country_id'] : null;
         $profile['vat'] = $data['vat'];
         $profile['taxpayernumber'] = $data['taxpayernumber'];
         $profile['status_id'] = $data['status_id'];
         $profile['legalform_id'] = $data['legalform_id'];
         $profile['type_id'] = $data['type_id'];
         $profile['legalform_id'] = $data['legalform_id'];
         $profile['type_id'] = !empty($data['type_id']) ? $data['type_id'] : Null;
         $profile['updated_at'] = date('Y-m-d h:i:s');
         if ($profile->trySave()) {
             // get the customer ID
             $data['profile_id'] = empty($data['profile_id']) ? $profile['profile_id'] : $data['profile_id'];
             return $profile['profile_id'];
         }
     }
     return false;
 }
開發者ID:kokkez,項目名稱:shineisp,代碼行數:51,代碼來源:DomainsProfiles.php

示例2: saveAll

 /**
  * Save all the data
  * @param array $params
  */
 public static function saveAll(array $params)
 {
     if (!empty($params['server_id']) && is_numeric($params['server_id'])) {
         $server = Doctrine::getTable('Servers')->find($params['server_id']);
     } else {
         $server = new Servers();
     }
     $server->name = $params['name'];
     $server->ip = $params['ip'];
     $server->netmask = $params['netmask'];
     $server->host = $params['host'];
     $server->domain = $params['domain'];
     $server->description = $params['description'];
     $server->status_id = intval($params['status_id']);
     $server->isp_id = intval($params['isp_id']);
     $server->type_id = intval($params['type_id']);
     $server->panel_id = intval($params['panel_id']) ? intval($params['panel_id']) : null;
     $server->cost = isset($params['cost']) && is_numeric($params['cost']) ? $params['cost'] : 0;
     $server->max_services = isset($params['max_services']) ? intval($params['max_services']) : 0;
     $server->datacenter = isset($params['datacenter']) ? $params['datacenter'] : '';
     $server->is_default = isset($params['is_default']) ? intval($params['is_default']) : 0;
     $server->buy_date = Shineisp_Commons_Utilities::formatDateIn($params['buy_date']);
     $server->save();
     // TODO: clear other default servers for the same group. Only one server can be default in the group
     return $server['server_id'];
 }
開發者ID:kokkez,項目名稱:shineisp,代碼行數:30,代碼來源:Servers.php

示例3: processAction

 /**
  * processAction
  * Update the record previously selected
  * @return unknown_type
  */
 public function processAction()
 {
     $redirector = Zend_Controller_Action_HelperBroker::getStaticHelper('redirector');
     $form = $this->getForm("/profile/process");
     $request = $this->getRequest();
     // Check if we have a POST request
     if (!$request->isPost()) {
         return $this->_helper->redirector('index', 'index', 'default');
     }
     if ($form->isValid($request->getPost())) {
         // Get the id
         $id = $this->getRequest()->getParam('customer_id');
         try {
             // Set the new values
             if (is_numeric($id)) {
                 $customer = Doctrine::getTable('Customers')->find($id);
                 $oldCustomer = $customer->toArray();
                 // Get the values posted
                 $params = $form->getValues();
                 $customer->company = $params['company'];
                 $customer->firstname = $params['firstname'];
                 $customer->lastname = $params['lastname'];
                 $customer->email = $params['email'];
                 $customer->birthdate = Shineisp_Commons_Utilities::formatDateIn($params['birthdate']);
                 if (!empty($params['password'])) {
                     $customer->password = MD5($params['password']);
                 }
                 $customer->birthplace = $params['birthplace'];
                 $customer->birthdistrict = $params['birthdistrict'];
                 $customer->birthcountry = $params['birthcountry'];
                 $customer->birthnationality = $params['birthnationality'];
                 $customer->vat = $params['vat'];
                 $customer->taxpayernumber = $params['taxpayernumber'];
                 $customer->type_id = !empty($params['company_type_id']) ? $params['company_type_id'] : NULL;
                 $customer->legalform_id = $params['legalform'];
                 $customer->gender = $params['gender'];
                 // Save the data
                 $customer->save();
                 $id = is_numeric($id) ? $id : $customer->getIncremented();
                 // Manage the address of the customer
                 $address = new Addresses();
                 $mainAddress = $address->findOneByUserId($id);
                 if ($mainAddress) {
                     $address = $mainAddress;
                 }
                 $address->address = $params['address'];
                 $address->city = $params['city'];
                 $address->code = $params['code'];
                 $address->country_id = $params['country_id'];
                 $address->area = $params['area'];
                 $address->customer_id = $id;
                 $address->save();
                 if (!empty($params['contact'])) {
                     $contacts = new Contacts();
                     $contacts->contact = $params['contact'];
                     $contacts->type_id = $params['contacttypes'];
                     $contacts->customer_id = $id;
                     $contacts->save();
                 }
                 // Add or Remove the customer email in the newsletter list
                 Customers::newsletter_subscription($id, $params['newsletter']);
                 $retval = Shineisp_Commons_Utilities::getEmailTemplate('profile_changed');
                 if ($retval) {
                     $subject = $retval['subject'];
                     $subject = str_replace("[user]", $params['firstname'] . " " . $params['lastname'], $retval['subject']);
                     // Alert the administrator about the changing of the customer information
                     $body = $retval['template'];
                     $body = str_replace("[user]", $params['firstname'] . " " . $params['lastname'], $body);
                     $body = str_replace("[old]", print_r($oldCustomer, true), $body);
                     $body = str_replace("[new]", print_r($customer->toArray(), true), $body);
                     $isp = Shineisp_Registry::get('ISP');
                     Shineisp_Commons_Utilities::SendEmail($isp->email, $isp->email, null, $subject, $body);
                 }
             }
         } catch (Exception $e) {
             echo $e->getMessage();
             die;
         }
         return $this->_helper->redirector('account', 'profile', 'default', array('mex' => 'The task requested has been executed successfully.', 'status' => 'success'));
     } else {
         $this->view->form = $form;
         $this->view->title = $this->translator->translate("Profile details");
         $this->view->description = $this->translator->translate("Update here your details filling the applicant form with all the information about you.");
         return $this->_helper->viewRenderer('applicantform');
     }
 }
開發者ID:kokkez,項目名稱:shineisp,代碼行數:91,代碼來源:ProfileController.php

示例4: saveAll

 /**
  * Save all the data in the database
  * @param array $data
  * @param integer $id
  */
 public static function saveAll(array $data, $id)
 {
     if (!empty($data) && is_array($data)) {
         if (is_numeric($id)) {
             $customer = Doctrine::getTable('Customers')->find($id);
             if ($customer->customer_id != $id) {
                 return false;
             }
             if ($customer->isp_id != Isp::getCurrentId()) {
                 return false;
             }
             $customer['created_at'] = date('Y-m-d h:i:s');
         } else {
             $customer = new Customers();
         }
         $customer['company'] = $data['company'];
         $customer['firstname'] = $data['firstname'];
         $customer['lastname'] = $data['lastname'];
         $customer['gender'] = $data['gender'];
         if (!empty($data['password'])) {
             $customer['password'] = crypt($data['password']);
         }
         $customer['email'] = $data['email'];
         $customer['birthplace'] = $data['birthplace'];
         $customer['birthdate'] = Shineisp_Commons_Utilities::formatDateIn($data['birthdate']);
         $customer['birthdistrict'] = $data['birthdistrict'];
         $customer['birthcountry'] = $data['birthcountry'];
         $customer['birthnationality'] = $data['birthnationality'];
         $customer['note'] = $data['note'];
         $customer['vat'] = $data['vat'];
         $customer['taxpayernumber'] = $data['taxpayernumber'];
         $customer['status_id'] = $data['status_id'];
         $customer['issubscriber'] = $data['issubscriber'];
         $customer['legalform_id'] = $data['legalform_id'];
         $customer['type_id'] = $data['type_id'];
         $customer['group_id'] = $data['group_id'];
         $customer['issubscriber'] = !empty($data['issubscriber']) ? 1 : 0;
         $customer['taxfree'] = !empty($data['taxfree']) ? 1 : 0;
         $customer['legalform_id'] = $data['legalform_id'];
         $customer['type_id'] = !empty($data['type_id']) ? $data['type_id'] : Null;
         $customer['parent_id'] = !empty($data['parent_id']) ? $data['parent_id'] : Null;
         $customer['isreseller'] = !empty($data['isreseller']) ? $data['isreseller'] : Null;
         $customer['ignore_latefee'] = (bool) $data['ignore_latefee'];
         $customer['language_id'] = $data['language_id'];
         $customer['updated_at'] = date('Y-m-d h:i:s');
         $customer['isp_id'] = Isp::getCurrentId();
         $customer->save();
         // get the customer ID
         $data['customer_id'] = empty($data['customer_id']) ? $customer['customer_id'] : $data['customer_id'];
         // Handle the customer address
         if (!empty($data['address'])) {
             Addresses::AddNew($data);
         }
         // Handle the customer contact
         if (!empty($data['contact'])) {
             Contacts::AddNew(array('contact' => $data['contact'], 'type_id' => $data['contacttypes'], 'customer_id' => $customer['customer_id']));
         }
         // Newsletter OptIn
         if (!empty($data['issubscriber']) && $data['issubscriber'] == 1) {
             NewslettersSubscribers::customer_optIn($customer['customer_id']);
             // Add the customer email in the newsletter list
         } else {
             NewslettersSubscribers::customer_optOut($customer['customer_id']);
             // Remove the customer email from the newsletter subscriber list
         }
         // Save the upload file
         self::UploadDocument($customer['customer_id'], $data['filecategory']);
         return $customer['customer_id'];
     }
     return false;
 }
開發者ID:kokkez,項目名稱:shineisp,代碼行數:76,代碼來源:Customers.php

示例5: loadRecords

 public function loadRecords(array $params)
 {
     $config = $this->getConfig();
     $records = array();
     $rows = array();
     $iTotalRecords = 0;
     $iFilteredTotal = 0;
     $sOrder = "";
     // Get the common information in order to read the records and the columns of the list
     $columns = !empty($config['datagrid']['columns']) ? $config['datagrid']['columns'] : null;
     $dq = !empty($config['datagrid']['dqrecordset']) && is_object($config['datagrid']['dqrecordset']) ? $config['datagrid']['dqrecordset'] : null;
     $recordset = !empty($config['datagrid']['recordset']) ? $config['datagrid']['recordset'] : null;
     // Check if the doctrine object is active
     if (!empty($dq) && is_object($dq)) {
         $iTotalRecords = $dq->count();
         $iFilteredTotal = $dq->count();
         $mainsearchvalue = !empty($params['sSearch']) ? $params['sSearch'] : null;
         if (!empty($params['iColumns'])) {
             // Filter the records per each column field
             for ($i = 0; $i < intval($params['iColumns']); $i++) {
                 if ($params['bSearchable_' . $i] == "true") {
                     $colsearchvalue = !empty($params['sSearch_' . $i]) ? $params['sSearch_' . $i] : null;
                     if (!empty($columns[$i]['field'])) {
                         if ($mainsearchvalue) {
                             if (Shineisp_Commons_Utilities::is_valid_date($mainsearchvalue)) {
                                 $mainsearchvalue = Shineisp_Commons_Utilities::formatDateIn($mainsearchvalue);
                                 $dq->orWhere($columns[$i]['field'] . " = ?", $mainsearchvalue);
                             } else {
                                 $dq->orWhere($columns[$i]['field'] . " like ?", "%{$mainsearchvalue}%");
                             }
                         } else {
                             if ($colsearchvalue) {
                                 if (Shineisp_Commons_Utilities::is_valid_date($colsearchvalue)) {
                                     $colsearchvalue = Shineisp_Commons_Utilities::formatDateIn($colsearchvalue);
                                     $dq->andWhere($columns[$i]['field'] . " = ?", $colsearchvalue);
                                 } else {
                                     $dq->andWhere($columns[$i]['field'] . " like ?", "%{$colsearchvalue}%");
                                 }
                             }
                         }
                     }
                 }
             }
         }
         $query = $dq->getSqlQuery();
         // Count the filtered records
         $temprs = $dq->execute(array(), Doctrine_Core::HYDRATE_ARRAY);
         $iFilteredTotal = count($temprs);
         // Paging of the records
         if (isset($params['iDisplayStart']) && $params['iDisplayLength'] != '-1') {
             $dq->offset($params['iDisplayStart']);
             $dq->limit($params['iDisplayLength']);
         }
         // Sorting of the records
         if (isset($params['iSortCol_0'])) {
             for ($i = 0; $i < intval($params['iSortingCols']); $i++) {
                 $j = 0;
                 if ($params['bSortable_' . intval($params['iSortCol_' . $i])] == "true") {
                     foreach ($columns as $column) {
                         if (!empty($column['sortable']) && $column['sortable']) {
                             if ($j == $params['iSortCol_0'] - 1) {
                                 $sOrder .= $column['field'] . " " . $params['sSortDir_' . $i] . ", ";
                             }
                             $j++;
                         }
                     }
                 }
             }
             $sOrder = substr_replace($sOrder, "", -2);
             if (!empty($sOrder)) {
                 $dq->orderBy($sOrder);
             }
         }
         #print_r($columns);
         #Zend_Debug::dump($sOrder);
         #print_r($dq->getDql());
         #Zend_Debug::dump($rs);
         #die;
         // Execute the doctrine object to get the record array
         $rs = $dq->execute(array(), Doctrine_Core::HYDRATE_ARRAY);
         // Complete the recordset with external values
         $rs = self::injectData($rs);
     } elseif (!empty($recordset) && is_array($recordset)) {
         $iFilteredTotal = count($recordset);
         $rs = $recordset;
     }
     $i = 0;
     // For each record do ...
     foreach ($rs as $record) {
         $row = array();
         $row['Row'] = "row_{$i}";
         foreach ($columns as $column) {
             if (!empty($column['alias'])) {
                 if (!empty($column['type'])) {
                     if ($column['type'] == "boolean") {
                         $badge = $record[$column['alias']] == 1 ? "badge-success" : "badge-important";
                         $label = $record[$column['alias']] == 1 ? $this->translator->translate("Yes") : $this->translator->translate("No");
                         $row[] = "<span class=\"badge {$badge}\">" . $label . "</span>";
                     } elseif ($column['type'] == "index") {
                         $badge = "badge-" . strtolower($record[$column['alias']]);
//.........這裏部分代碼省略.........
開發者ID:kokkez,項目名稱:shineisp,代碼行數:101,代碼來源:Ajaxgrid.php

示例6: processAction

 /**
  * processAction
  * Update the record previously selected
  * @return unknown_type
  */
 public function processAction()
 {
     $form = $this->getForm("/admin/invoices/process");
     $request = $this->getRequest();
     $attachment = $form->getElement('attachments');
     // Check if we have a POST request
     if (!$request->isPost()) {
         return $this->_helper->redirector('list', 'invoices', 'admin');
     }
     // 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/invoices/list", "label" => $this->translator->translate('List'), "params" => array('css' => null, 'id' => 'submit')), array("url" => "/admin/invoices/new/", "label" => $this->translator->translate('New'), "params" => array('css' => null)));
     if ($form->isValid($request->getPost())) {
         // Get the id
         $id = $this->getRequest()->getParam('invoice_id');
         // Set the new values
         if (is_numeric($id)) {
             $this->invoices = Doctrine::getTable('Invoices')->find($id);
         }
         // Get the values posted
         $params = $form->getValues();
         try {
             $this->invoices->invoice_date = Shineisp_Commons_Utilities::formatDateIn($params['invoice_date']);
             $this->invoices->number = $params['number'];
             $this->invoices->order_id = $params['order_id'];
             $this->invoices->note = $params['note'];
             // Save the data
             $this->invoices->save();
             $id = is_numeric($id) ? $id : $this->invoices->getIncremented();
             // Update formatted_number
             if ($this->invoices->formatted_number != $params['formatted_number'] || empty($this->invoices->formatted_number)) {
                 $this->invoices->formatted_number = !empty($params['formatted_number']) ? $params['formatted_number'] : Invoices::generateNumber($id);
                 $this->invoices->save();
             }
         } catch (Exception $e) {
             $this->_helper->redirector('list', 'invoices', 'admin', array('mex' => $this->translator->translate('The invoice cannot be created. Please check all your input data and try again.'), 'status' => 'danger'));
         }
         $this->_helper->redirector('edit', 'invoices', 'admin', array('id' => $id, 'mex' => $this->translator->translate('The task requested has been executed successfully.'), 'status' => 'success'));
     } else {
         $this->view->form = $form;
         $this->view->title = $this->translator->translate("Invoice Edit");
         $this->view->description = $this->translator->translate("Here you can edit the selected invoice.");
         return $this->render('applicantform');
     }
 }
開發者ID:kokkez,項目名稱:shineisp,代碼行數:49,代碼來源:InvoicesController.php

示例7: addpayment

 /**
  * addpayment
  * Add a payment information to a order
  * @param integer $orderid
  * @param string $transactionid
  * @param integer $bankid
  * @param boolean $status
  * @param float $amount
  */
 public static function addpayment($orderid, $transactionid, $bankid, $status, $amount, $paymentdate = null, $customer_id = null, $payment_description = null)
 {
     $payment = new Payments();
     // We make a double check to properly manage "null" output coming from Shineisp_Commons_Utilities::formatDateIn
     if (!empty($paymentdate)) {
         $paymentdate = Shineisp_Commons_Utilities::formatDateIn($paymentdate);
     }
     $paymentdate = !empty($paymentdate) ? $paymentdate : date('Y-m-d H:i:s');
     // Set the payment data
     $payment->order_id = $orderid;
     $payment->bank_id = $bankid;
     $payment->reference = $transactionid;
     $payment->confirmed = 0;
     $payment->income = $amount;
     // Additional fields for Orders::saveAll()
     $payment->paymentdate = $paymentdate;
     $payment->customer_id = isset($customer_id) ? intval($customer_id) : intval(Orders::getCustomer($orderid));
     $payment->description = isset($payment_description) ? $payment_description : null;
     $save = $payment->trySave();
     if ($save) {
         Shineisp_Commons_Utilities::logs("Payments::addPayment(): save ok");
         // Confirm payment, if needed. Invoices::confirm() will activate order.
         if ($status) {
             self::confirm($orderid, $status);
         }
     }
     return $save;
 }
開發者ID:kokkez,項目名稱:shineisp,代碼行數:37,代碼來源:Payments.php

示例8: addOrderItem

 /**
  * Add an item within an order
  *
  * @param Cart $item
  * @throws Exception
  * @return unknown
  */
 public static function addOrderItem(CartItem $item)
 {
     if (empty(self::$order)) {
         throw new Exception('The order has not been created yet', 1000);
     }
     try {
         // get the item subtotals
         $subtotals = $item->getSubtotals();
         // get the options
         $options = $item->getOptions();
         // Get the order object previously created
         $order = self::$order;
         // add a new item
         $orderitem = new OrdersItems();
         $orderitem->order_id = $order['order_id'];
         if ("domain" == $item->getType()) {
             // Create a new domain order item
             $orderitem->tld_id = !empty($options['domain']['tld']) ? $options['domain']['tld'] : null;
             $orderitem->parameters = json_encode($options);
         } else {
             $orderitem->product_id = $item->getId();
             $orderitem->parameters = json_encode(ProductsAttributes::getSystemAttributes($item->getId()));
         }
         $orderitem->status_id = Statuses::id("tobepaid", "orders");
         $orderitem->date_start = date('Y-m-d H:i:s');
         $orderitem->date_end = null;
         $orderitem->description = $item->getName();
         $orderitem->quantity = $item->getQty();
         $orderitem->price = $item->getUnitprice();
         $orderitem->billing_cycle_id = $item->getBillingid();
         $orderitem->vat = $subtotals['taxes'];
         $orderitem->percentage = $subtotals['percentage'];
         $orderitem->uuid = $item->getUid();
         // Count of the day until the expiring
         if ($item->getIsrecurring()) {
             // get the months until of the next service expiration
             $months = $subtotals['months'];
             if ($months > 0) {
                 $totmonths = intval($item->getQty() * $months);
                 // Calculate the total of the months
                 $date_end = Shineisp_Commons_Utilities::add_date(date('d-m-Y H:i:s'), null, $totmonths);
                 $orderitem->date_end = Shineisp_Commons_Utilities::formatDateIn($date_end);
             } else {
                 $orderitem->date_end = null;
             }
         }
         $orderitem->cost = $item->getCost();
         $orderitem->setupfee = $subtotals['setupfee'];
         $orderitem->subtotal = $subtotals['subtotal'];
         // Save the order item
         if ($orderitem->trySave()) {
             // Attach all the the domain to the order
             if ("domain" == $item->getType()) {
                 $domain = $options['domain']['name'];
                 $tld = $options['domain']['tld'];
                 $domainId = Domains::Create($domain, $tld, $order->customer_id, $orderitem->detail_id);
                 if (is_numeric($domainId)) {
                     $ordersitemsdomains = new OrdersItemsDomains();
                     $ordersitemsdomains->domain_id = $domainId;
                     $ordersitemsdomains->order_id = $order['order_id'];
                     $ordersitemsdomains->orderitem_id = $orderitem->detail_id;
                     $ordersitemsdomains->save();
                 }
             }
             // Update the totals of the order
             self::updateTotalsOrder($order['order_id']);
             return $orderitem;
         }
     } catch (Exception $e) {
         Shineisp_Commons_Utilities::log('There was a problem during the order creation: ' . $e->getMessage());
     }
     return false;
 }
開發者ID:kokkez,項目名稱:shineisp,代碼行數:80,代碼來源:Orders.php

示例9: processAction

 /**
  * processAction
  * Update the record previously selected
  * @return unknown_type
  */
 public function processAction()
 {
     $redirector = Zend_Controller_Action_HelperBroker::getStaticHelper('redirector');
     $form = $this->getForm("/admin/tickets/process");
     $request = $this->getRequest();
     $this->view->title = $this->translator->translate("New 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)));
     // Check if we have a POST request
     if (!$request->isPost()) {
         $this->_helper->redirector('list', 'tickets', 'admin');
     }
     if ($form->isValid($request->getPost())) {
         // Get the values posted
         $params = $request->getPost();
         // Get the id
         $id = $this->getRequest()->getParam('ticket_id');
         // create the ticket if not exist
         if (!is_numeric($id)) {
             $id = Tickets::saveIt(null, $params['customer_id'], $params['subject'], $params['note'], $params['category_id']);
             $redirector->gotoUrl("/admin/tickets/edit/id/{$id}#last");
         }
         $date = !empty($params['datetime']) ? Shineisp_Commons_Utilities::formatDateIn($params['datetime']) : null;
         $note = !empty($params['note']) ? $params['note'] : null;
         $status = !empty($params['status_id']) && is_numeric($params['status_id']) ? $params['status_id'] : null;
         $sendemail = !empty($params['sendemail']) && is_numeric($params['sendemail']) ? true : false;
         // Save the Ticket Note and send the email to the customer
         $ticketNote = TicketsNotes::saveIt($id, $date, $note, $status, true, null, $sendemail);
         // Update the sibling
         if (!empty($params['sibling_id']) && is_numeric($params['sibling_id'])) {
             Tickets::setSibling($id, $params['sibling_id']);
         }
         // Update the operator for the selected ticket
         if (!empty($params['user_id']) && is_numeric($params['user_id'])) {
             Tickets::setOperator($id, $params['user_id']);
         }
         // Update the ticket attaching the order
         if (!empty($params['order_id']) && is_numeric($params['order_id'])) {
             Tickets::setOrder($id, $params['order_id']);
         }
         $redirector->gotoUrl("/admin/tickets/edit/id/{$id}#last");
     } else {
         $this->view->form = $form;
         return $this->render('applicantform');
     }
 }
開發者ID:moay,項目名稱:shineisp,代碼行數:52,代碼來源:TicketsController.php

示例10: servicesGrid

 private function servicesGrid()
 {
     $request = Zend_Controller_Front::getInstance()->getRequest();
     try {
         if (isset($request->id) && is_numeric($request->id)) {
             // In order to select only the fields interested we have to add an alias to all the fields. If the aliases are not created Doctrine will require an index field for each join created.
             //$rs = Products::getAllServicesByCustomerID ( $request->id, 'oi.detail_id as detail_id, pd.name as productname' );
             $rs = Products::getAllServicesByCustomerID($request->id, 'o.order_id, oi.detail_id as detail_id, pd.name as productname, DATE_FORMAT(oi.date_start, "%d/%m/%Y") AS date_start, DATE_FORMAT(oi.date_end, "%d/%m/%Y") AS date_end, DATEDIFF(oi.date_end, CURRENT_DATE) AS daysleft, oi.price as price, oi.autorenew as autorenew, oi.status_id as status');
             if ($rs) {
                 $arrStatuses = Statuses::getList('orders');
                 foreach ($rs as $k => $v) {
                     if (isset($v['price'])) {
                         //* TODO: Format price based on locale
                         $rs[$k]['price'] = $v['price'];
                     }
                     if (isset($v['status']) && isset($arrStatuses[$v['status']])) {
                         $rs[$k]['status'] = $arrStatuses[$v['status']];
                     }
                     if (isset($v['autorenew'])) {
                         $rs[$k]['autorenew'] = $v['autorenew'] == 1 ? $this->translator->translate('Yes') : $this->translator->translate('Yes');
                     }
                     if (isset($v['date_start'])) {
                         $rs[$k]['date_start'] = Shineisp_Commons_Utilities::formatDateIn($v['date_start']);
                     }
                     if (isset($v['date_end'])) {
                         $rs[$k]['date_end'] = Shineisp_Commons_Utilities::formatDateIn($v['date_end']);
                     }
                 }
                 $columns[] = $this->translator->translate('Product');
                 $columns[] = $this->translator->translate('Creation Date');
                 $columns[] = $this->translator->translate('Expiry Date');
                 $columns[] = $this->translator->translate('Days left');
                 $columns[] = $this->translator->translate('Price');
                 $columns[] = $this->translator->translate('Automatic renewal');
                 $columns[] = $this->translator->translate('Status');
                 return array('name' => 'services', 'columns' => $columns, 'records' => $rs, 'edit' => array('controller' => 'ordersitems', 'action' => 'edit'), 'pager' => true);
             }
         }
     } catch (Exception $e) {
         $this->_helper->redirector('edit', 'customers', 'admin', array('id' => $request->id, 'mex' => $this->translator->translate('Unable to process the request at this time.') . ": " . $e->getMessage(), 'status' => 'danger'));
     }
 }
開發者ID:moay,項目名稱:shineisp,代碼行數:42,代碼來源:CustomersController.php

示例11: save_data

 /**
  * Save all the information about the newsletter
  * @param array $params
  */
 public static function save_data($params)
 {
     if (is_numeric($params['news_id'])) {
         $newsletter = self::getbyId($params['news_id']);
     } else {
         $newsletter = new Newsletters();
     }
     $newsletter['subject'] = $params['subject'];
     $newsletter['sendat'] = Shineisp_Commons_Utilities::formatDateIn($params['sendat']);
     $newsletter['sent'] = Shineisp_Commons_Utilities::formatDateIn($params['sent']);
     $newsletter['message'] = $params['message'];
     $newsletter->save();
     // If the newsletter has been already sent and you'd like to send it again, clear the history
     if ($params['sendagain']) {
         NewslettersHistory::clear_queue($newsletter['news_id']);
         // Update the sent field value
         $newsletter['sent'] = null;
         $newsletter->save();
     }
     // Create the queue
     NewslettersHistory::add_all_to_queue($newsletter['news_id']);
     return $newsletter['news_id'];
 }
開發者ID:kokkez,項目名稱:shineisp,代碼行數:27,代碼來源:Newsletters.php

示例12: saveData

 /**
  * Save the record
  *
  * @param posted var from the form
  * @return Boolean
  */
 public static function saveData($record, $id = null)
 {
     // Set the new values
     if (is_numeric($id)) {
         $panelaction = self::find($id);
     } else {
         $panelaction = new PanelsActions();
     }
     $panelaction->action = $record['action'];
     $panelaction->start = Shineisp_Commons_Utilities::formatDateIn($record['start']);
     $panelaction->end = Shineisp_Commons_Utilities::formatDateIn($record['end']);
     $panelaction->log = $record['log'];
     $panelaction->panel_id = $record['panel_id'];
     $panelaction->parameters = $record['parameters'];
     $panelaction->status_id = $record['status_id'];
     if ($panelaction->trySave()) {
         return $panelaction->panel_id;
     }
     return false;
 }
開發者ID:kokkez,項目名稱:shineisp,代碼行數:26,代碼來源:PanelsActions.php

示例13: saveAll

 /**
  * Save all the data
  * @param array $data
  */
 public static function saveAll($id, $data)
 {
     // Set the new values
     if (is_numeric($id)) {
         $invoice = self::find($id);
     } else {
         $invoice = new PurchaseInvoices();
     }
     $invoice['creationdate'] = Shineisp_Commons_Utilities::formatDateIn($data['creationdate']);
     $invoice['expiringdate'] = Shineisp_Commons_Utilities::formatDateIn($data['expiringdate']);
     $invoice['paymentdate'] = !empty($data['paymentdate']) ? Shineisp_Commons_Utilities::formatDateIn($data['paymentdate']) : "";
     $invoice['number'] = $data['number'];
     $invoice['company'] = $data['company'];
     $invoice['category_id'] = $data['category_id'];
     $invoice['method_id'] = $data['method_id'];
     $invoice['total_net'] = $data['total_net'];
     $invoice['total_vat'] = $data['total_vat'];
     $invoice['total'] = $data['total'];
     $invoice['note'] = $data['note'];
     $invoice['status_id'] = $data['status_id'];
     $invoice->save();
     self::UploadDocument($invoice['purchase_id']);
     return $invoice['purchase_id'];
 }
開發者ID:kokkez,項目名稱:shineisp,代碼行數:28,代碼來源:PurchaseInvoices.php

示例14: saveData

 /**
  * Save the record
  *
  * @param posted var from the form
  * @return Boolean
  */
 public static function saveData($record, $id = null)
 {
     // Set the new values
     if (is_numeric($id)) {
         $domainstasks = self::find($id);
     } else {
         $domainstasks = new DomainsTasks();
     }
     $domainstasks->action = $record['action'];
     $domainstasks->startdate = Shineisp_Commons_Utilities::formatDateIn($record['startdate']);
     $domainstasks->enddate = Shineisp_Commons_Utilities::formatDateIn($record['enddate']);
     $domainstasks->registrars_id = $record['registrars_id'];
     $domainstasks->domain_id = $record['domain_id'];
     $domainstasks->status_id = $record['status_id'];
     if ($domainstasks->trySave()) {
         return $domainstasks->task_id;
     }
     return false;
 }
開發者ID:kokkez,項目名稱:shineisp,代碼行數:25,代碼來源:DomainsTasks.php

示例15: chkFieldType

 /**
  * chkFieldType
  * Check the type of the data and fix the value
  * @param string $value
  */
 private function chkFieldType(array $column, $value)
 {
     if ($column['type'] == "date") {
         return Shineisp_Commons_Utilities::formatDateIn($value);
     }
     return $value;
 }
開發者ID:kokkez,項目名稱:shineisp,代碼行數:12,代碼來源:Datagrid.php


注:本文中的Shineisp_Commons_Utilities::formatDateIn方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。