public function ordersAction() { $from = AF::get($this->params, 'from', false); $clearArray = array(); $this->filter($clearArray); if (!isset($this->params['r_dates'])) { $today = date("d.m.Y"); $this->params['r_dates'] = $today . '-' . $today; } $pagination = new Pagination(array('action' => $this->action, 'controller' => $this->controller, 'params' => $this->params, 'ajax' => true)); $models = AFActiveDataProvider::models('Attempt', $this->params, $pagination); $dataProvider = $models->getDeclineOrdersReport(); $filterFields = Attempt::$FilterFields = $models->getoutFilterFields($clearArray, array('r_dates')); $fields = array('order_formatted', 'type_formatted', 'status_note', 'created_formatted'); $gateways = $models->getDSearchGateways(); $reasons = $models->getDSearchReasons(); // set ajax table if (AF::isAjaxRequestModels()) { $this->view->includeFile('_orders_table', array('application', 'views', 'declinedreports'), array('access' => $this->access, 'controller' => $this->controller, 'dataProvider' => $dataProvider, 'pagination' => $pagination, 'filterFields' => $filterFields, 'fields' => $fields, 'gateways' => $gateways, 'reasons' => $reasons)); die; } Assets::css('jquery-ui'); Assets::js('//code.jquery.com/ui/1.10.3/jquery-ui.js'); Assets::js('dateRange/jquery.daterange'); Assets::js('ajax_table'); $this->render('orders', array('dataProvider' => $dataProvider, 'pagination' => $pagination, 'filterFields' => $filterFields, 'fields' => $fields, 'gateways' => $gateways, 'reasons' => $reasons, 'from' => $from)); }
function welcomeAction() { $filterFields = array(); $dataProvider = array(); if ($this->access->actionAccess('dashboard')) { if (!isset($this->params['dates'])) { //$dataFrom=mktime(0, 0, 0, date("m"), date("d")-1, date("Y")); $fromDate = date("d.m.Y"); $this->params['dates'] = $fromDate . '-' . $fromDate; } $models = AFActiveDataProvider::models('Order', $this->params); $dataProvider = $models->dashboard(); $filterFields = $models->getoutFilterFields(array(), array('dates')); // set ajax table if (AF::isAjaxRequestModels()) { $this->view->includeFile('_dashboard', array('application', 'views', 'home'), array('access' => $this->access, 'controller' => $this->controller, 'dataProvider' => $dataProvider, 'filterFields' => $filterFields)); die; } Assets::css('jquery-ui'); Assets::js('jquery-ui'); Assets::js('dateRange/jquery.daterange'); Assets::js('ajax_table'); Assets::js('//www.google.com/jsapi'); } $this->addToPageTitle(__('welcome')); $this->render('welcome', array('dataProvider' => $dataProvider, 'filterFields' => $filterFields)); }
function viewAction() { $clearArray = array('action', 'section'); $this->filter($clearArray); if (!isset($this->params['dates'])) { //$dataFrom=mktime(0, 0, 0, date("m"), date("d"), date("Y")-2); //$fromDate = date("d.m.Y", $dataFrom); $today = date("d.m.Y"); $this->params['dates'] = $today . '-' . $today; } $pagination = new Pagination(array('action' => $this->action, 'controller' => $this->controller, 'params' => $this->params, 'ajax' => true)); $models = AFActiveDataProvider::models('Log', $this->params, $pagination); $dataProvider = $models->getAll(); $filterFields = $models->getoutFilterFields($clearArray, array('dates')); // set ajax table if (AF::isAjaxRequestModels()) { $this->view->includeFile('_table', array('application', 'views', 'logs'), array('access' => $this->access, 'controller' => $this->controller, 'dataProvider' => $dataProvider, 'pagination' => $pagination, 'filterFields' => $filterFields)); die; } $this->addToPageTitle('Logs'); Assets::css('jquery-ui'); Assets::js('jquery-ui'); Assets::js('dateRange/jquery.daterange'); Assets::js('ajax_table'); Assets::js('af_input_field'); $this->render('view', array('dataProvider' => $dataProvider, 'pagination' => $pagination, 'models' => $models, 'filterFields' => $filterFields)); }
function deleteAction() { /* This is from profilegateways $id = AF::get($_POST, 'id', 0); $ids = explode('_', $id); $errors = FALSE; $model = new ProfileGateway(); $model->profile_id = $ids[0]; $model->method_id = $ids[1]; $model->gateway_id = $ids[2]; $model->delete(); unset($model); Message::echoJsonSuccess(__('gateway_removed')); $this->redirect(); */ $id = AF::get($_POST, 'id', 0); $errors = FALSE; $model = new GatewayLimit(); $model->model_uset_id = $this->user->user_id; if ($model->findByPk($id)) { $model->delete(); } else { $errors = TRUE; } if ($model->getErrors()) { $errors = TRUE; } unset($model); Message::echoJsonSuccess(__('limit_removed')); $this->redirect(); }
function viewAction() { $clearArray = array('flags'); $this->filter($clearArray); if (empty($this->params)) { $today = date("d.m.Y"); $this->params['dates'] = $today . '-' . $today; } $pagination = new Pagination(array('action' => $this->action, 'controller' => $this->controller, 'params' => $this->params, 'ajax' => true)); $models = AFActiveDataProvider::models('ProspectEmail', $this->params, $pagination); $dataProvider = $models->getAll(); $filterFields = $models->getoutFilterFields($clearArray, array('dates')); // set ajax table if (AF::isAjaxRequestModels()) { $this->view->includeFile('_table', array('application', 'views', 'emails'), array('access' => $this->access, 'controller' => $this->controller, 'dataProvider' => $dataProvider, 'pagination' => $pagination, 'filterFields' => $filterFields)); die; } $campaigns = Campaign::model()->cache()->findAllInArray(); $templates = Template::model()->cache()->findAllInArray(); $flags = ProspectEmail::getEmailFlags(); /* $campaignsFilter = $models->getFilterCampaigns(); $templatesFilter = $models->getFilterTemplates(); $flagsFilter = $models->getFilterFlags(); */ Assets::css('jquery-ui'); Assets::js('jquery-ui'); Assets::js('dateRange/jquery.daterange'); Assets::js('ajax_table'); Assets::js('af_input_field'); $this->addToPageTitle(__('prospect_emails')); $this->render('view', array('dataProvider' => $dataProvider, 'pagination' => $pagination, 'models' => $models, 'filterFields' => $filterFields, 'campaigns' => $campaigns, 'templates' => $templates, 'flags' => $flags)); }
private function createBreadCrumbs() { if (!$this->link) { return; } $breadCrumbs = array(); foreach ($this->link as $key => $value) { $model = new BreadCrumbItem(); if (is_array($value)) { if (isset($value[1])) { $array = $value[0]; $params = $value[1]; } else { $array = $value; $params = array(); } $link = AF::link($array, $params); $model->label = $key; $model->link = $link ? $link : null; } else { $model->label = $value; $model->link = null; } $breadCrumbs[] = $model; unset($model); } $this->bca = $breadCrumbs; unset($breadCrumbs); }
function resetAction() { $userID = AF::get($this->params, 'idUser'); $activKey = AF::get($this->params, 'activkey'); $reset = AF::get($this->params, 'reset'); if (!$userID || !$activKey || !$reset) { throw new AFHttpException(0, 'bad_request', 404); } $userModel = User::model()->findByPk($userID); if (!$userModel || $userModel->activkey != $activKey || $reset != 'true') { throw new AFHttpException(0, 'bad_request', 404); } if (isset($_POST['reset_password']) && isset($_POST['ajax'])) { $password = trim(AF::get($_POST, 'password')); if (strlen($password) < 4) { Message::echoJsonError(__('small_password')); } $userModel->password = $password; $userModel->activkey = ''; if ($userModel->save()) { Message::echoJsonSuccess(__('your_password_changed')); } else { Message::echoJsonError(__('your_password_not_changed')); } } $this->addToPageTitle(__('reset_your_password')); Assets::cleanJs(); Assets::js('jquery.min'); Assets::js('jquery.form'); $this->render('reset', array()); }
function __construct() { $this->params = func_get_args(); $this->createUrl(); $this->pageCount = ceil($this->params[1] / $this->itemsPerPage); $this->currentPage = AF::get($this->params[0], 'page', 1); }
public function getContent() { $modelName = strtolower(get_class($this)); $file = AF::path($this->view, array('application', 'views', 'widgets', $modelName)); $this->before(); ob_start(); @(include $file); return ob_get_clean(); }
private static function fillFromDatabase() { $cacheID = "all_currencies"; self::$_allCurrencies = AF::cache()->get($cacheID); if (!self::$_allCurrencies) { $db = self::$_msql = SafeMySQL::getInstance(); $sql = "SELECT * FROM `currency`"; self::$_allCurrencies = $db->getInd('currency_id', $sql); AF::cache()->set($cacheID, self::$_allCurrencies); } }
private static function load($lang) { if (isset(Lang::$_cache[$lang])) { return Lang::$_cache[$lang]; } $table = AF::load($lang, array('languages')); if (!$table) { $table = array(); } return Lang::$_cache[$lang] = $table; }
public function before() { $this->countPage = ceil($this->countItems / $this->countInPage); if ($this->page > $this->countPage && $this->page > 1 && !$this->ajax) { $page = $this->countPage > 1 ? $this->countPage : 1; $workPath = AF::workPath(); header('Location: ' . $workPath . $this->url . $page); exit; } $this->pageStart = $this->page - $this->countVisible > 0 ? $this->page - $this->countVisible : 1; $this->pageFinish = $this->page + $this->countVisible < $this->countPage ? $this->page + $this->countVisible : $this->countPage; $this->paginationFirstPage = $this->page - $this->countVisible > 1 ? true : false; $this->paginationLastPage = $this->page + $this->countVisible < $this->countPage ? true : false; }
function generalAction() { if (isset($_POST['model']) && ($_POST['model'] = 'User')) { $this->user->name = AF::get($_POST, 'name'); $this->user->password = AF::get($_POST, 'password'); $this->user->settings; if ($this->user->save(false)) { Message::echoJsonSuccess(__('user_settings_updated')); } else { Message::echoJsonError(__('user_settings_not_updated')); } } $this->addToPageTitle(__('general') . ' ' . __('settings')); Assets::js('jquery.form'); $this->render('general', array()); }
/** * Show the customers orders with address for each order in case they use different addresses. */ function openAction() { $customer_id = AF::get($this->params, 'customer_id', false); // Get the $_GET['customer_id'] if (!$customer_id) { throw new AFHttpException(0, 'no_customer_id'); } // uses en.php to get string $this->filter(); $pagination = new Pagination(array('action' => $this->action, 'controller' => $this->controller, 'params' => $this->params)); $models = AFActiveDataProvider::models('Customer', $this->params, $pagination); $dataProvider = $models->getOrdersByCustomerId($customer_id); $orderModel = new Order(); $labels = $orderModel->attributeLabels(); $this->addToPageTitle('View Client'); $this->render('open', array('lables' => $labels, 'pagination' => $pagination, 'dataProvider' => $dataProvider, 'countOrders' => count($dataProvider), 'email' => $dataProvider[0]->email)); }
public static function saveCsvCustom($array, $fulfillmentModel, $path = array('files', 'csv')) { $file = AF::path($fulfillmentModel->csvFileName, $path, 'csv'); $current = ""; $delim = $fulfillmentModel->fulfillment_delimiter; foreach ($array as $item) { $i = 0; foreach ($item as $value) { if ($i) { $current .= $delim; } $current .= '"' . $value . '"'; $i++; } $current .= "\n"; } file_put_contents($file, $current); return $file; }
protected function createFilter() { $searchFields = $this->searchFields; $restrictionsFields = array(0 => array('campaign_id', 'aff_id')); if ($searchFields['campaign_id'] !== null || in_array('campaign_id', $restrictionsFields[0])) { $campaignsID = AF::userAccess()->getRestrictionSearchFields('campaign_id', $searchFields['campaign_id']); if ($campaignsID) { $where = self::$_msql->parse(" AND p.`campaign_id` IN (?a)", $campaignsID); $this->setwhere($where, 'campaign_id'); unset($campaignsID, $where); } } if (in_array('aff_id', $restrictionsFields[0])) { $IDs = AF::userAccess()->getRestrictionSearchFields('aff_id', array()); if ($IDs) { $where = self::$_msql->parse(" AND p.`aff_id` IN (?a)", $IDs); $this->setwhere($where, 'aff_id'); unset($IDs, $where); } } }
public static function getHtmlInfo($db) { echo '<script>var count_sql_queries = "' . $db->getQueryCount() . '"</script>'; echo '<div class="service_info"><div class="container">'; echo '<div class="t1">'; $format = "Execution time: %f second."; printf($format, self::$ScriptTime); echo '<br>Sql queries: <span id="count_sql_queries">' . $db->getQueryCount() . '</span> '; $array = $db->getStats(); if ($array) { echo ' <a href="javascript:serviceInfoQuerysDiv()">Show querys</a></div>'; } echo '<div class="t2">'; echo 'Memory consumption: ' . number_format(self::$totalMemory, 0, '.', ',') . ' bytes<br>'; echo 'Peak memory usage: ' . number_format(self::$memoryPeak, 0, '.', ',') . ' bytes'; $cacheStat = AF::cache()->stats(); $pUse = ($cacheStat['cmd_get'] - $cacheStat['cmd_set']) * 100 / $cacheStat['cmd_get']; echo '</div><div class="t3">Use memcache: <b>' . round($pUse) . '% (' . $cacheStat['cmd_get'] . '/' . $cacheStat['cmd_set'] . ')</b><br><a href="javascript:serviceInfoCacheDiv()">Show memcache info</a></div>'; echo '<div class="service_info_querys" style="display:none;">'; if ($array) { $i = 1; foreach ($array as $value) { echo '<br>' . $i . '. Sql: <b>' . $value['query'] . '</b>. <br>Time: ' . $value['timer']; $i++; } } echo '<br><br><div class="ajax hide"><b>Ajax sql</b><div></div></div>'; echo '</div>'; echo '<div class="service_info_cache" style="display:none;">'; foreach ($cacheStat as $key => $value) { if (isset(self::$_cacheInfo[$key])) { echo '<br>' . self::$_cacheInfo[$key] . ': <b>' . $value . '</b>'; } } echo '</div></div>'; }
function deleteAction() { $id = AF::get($_POST, 'id', 0); $modelsID = explode(',', $id); $errors = FALSE; foreach ($modelsID as $id) { $model = new Tax(); $model->model_uset_id = $this->user->user_id; if ($model->fillFromDbPk($id)) { $model->delete($id); } else { $errors = TRUE; } if ($model->getErrors()) { $errors = TRUE; } unset($model); } if (isset($_POST['ajax'])) { AF::setJsonHeaders('json'); if ($errors) { Message::echoJsonError(__('tax_not_deleted')); } else { $countE = AF::get($_POST, 'countE', 100000); // if the delete request came from an update page, we need to redirect if (count($modelsID) >= $countE || stripos($_SERVER['HTTP_REFERER'], 'taxes/update') !== false) { $link = AF::link(array('taxes' => 'view')); Message::echoJsonRedirect($link); } else { Message::echoJsonSuccess(__('tax_deleted')); } } } $this->redirect('view'); //$this->redirect(); }
public function downloadFromFulfillment() { $arrayCsvFiles = array(); $arrayCsvFilesClear = array(); $sql = "SELECT *\n FROM `fulfillment_files`\n WHERE `fulfillment_id`=?i"; $result = self::$_msql->getInd('filename', $sql, $this->fulfillment_id); if ($this->ssl) { $sftp = new Net_SFTP($this->server); if (!$sftp->login($this->username, $this->password)) { exit('Login Failed'); } //$contents = $sftp->nlist("{$this->download_path}"); $dPath = trim($this->download_path, '/'); $contents = $sftp->nlist("{$dPath}"); if (!$contents) { return; } foreach ($contents as $file) { if (substr($file, -4, 4) == '.csv') { $arrayCsvFiles[] = $arrayCsvFilesClear[] = $file; } } foreach ($arrayCsvFiles as $file) { $tF = explode('/', $file); $fName = array_pop($tF); if (isset($result["{$fName}"])) { continue; } $downloadFilePath = AF::path(time() . rand(1, 1000), array('files', 'csv', 'temp'), 'csv'); if ($sftp->get($dPath . '/' . $file, $downloadFilePath)) { self::parserCsvFiles($downloadFilePath); $sql = "INSERT INTO `fulfillment_files` (`fulfillment_id`, `filename`, `time`) VALUES (?i, ?s, NOW())"; self::$_msql->query($sql, $this->fulfillment_id, $fName); } } $sftp->_disconnect(0); } else { $ftp = ftp_connect($this->server, $this->port, 300); if (!$ftp) { return; } if ($this->username && $this->password) { ftp_login($ftp, $this->username, $this->password); } ftp_pasv($ftp, true); // Passive mode $contents = ftp_nlist($ftp, "{$this->download_path}"); if (!$contents) { return; } foreach ($contents as $file) { if (substr($file, -4, 4) == '.csv') { $file = str_replace('\\', '/', $file); $arrayCsvFiles[] = $file; $tF = explode('/', $file); $arrayCsvFilesClear[] = (string) trim(array_pop($tF)); } } foreach ($arrayCsvFiles as $file) { $tF = explode('/', $file); $fName = (string) trim(array_pop($tF)); if (isset($result["{$fName}"])) { continue; } $downloadFilePath = AF::path(time() . rand(1, 1000), array('files', 'csv', 'temp'), 'csv'); if (ftp_get($ftp, $downloadFilePath, $file, FTP_ASCII)) { self::parserCsvFiles($downloadFilePath); $sql = "INSERT INTO `fulfillment_files` (`fulfillment_id`, `filename`, `time`) VALUES (?i, ?s, NOW())"; self::$_msql->query($sql, $this->fulfillment_id, $fName); } } ftp_close($ftp); } $sql = "DELETE FROM `fulfillment_files`\n WHERE `fulfillment_id` = ?i\n AND `filename` NOT IN (?a)"; self::$_msql->query($sql, $this->fulfillment_id, $arrayCsvFilesClear); }
function cloneAction() { if (isset($_POST['clone'])) { $model = AFActiveDataProvider::models('Campaign'); $campaigns = $model->getCampaigns(); $campaigns = AF::userAccess()->array2RestrictionArray('campaign_id', $campaigns); AF::setJsonHeaders('json'); echo json_encode(array('campaigns' => $campaigns)); die; } if (isset($_POST['ajax'])) { AF::setJsonHeaders('json'); $campaign_id = AF::get($_POST, 'campaign_id', 0); $pixel_ids = AF::get($_POST, 'pixel_id', 0); if (AF::userAccess()->hasRestrictions('campaign_id')) { $rf = AF::userAccess()->getRestrictionSearchFields('campaign_id', array()); if (!in_array($campaign_id, $rf)) { Message::echoJsonError(__('pixel_not_cloned')); } } if (!$pixel_ids && !$campaign_id) { Message::echoJsonError(__('campaign_id_not_found')); } $pixels = explode(',', $pixel_ids); $message = array(); $newIDs = array(); $isMany = count($pixels) > 1 ? true : false; $isThisCampaign = true; foreach ($pixels as $pixel_id) { $model = new Pixel(); if (!$model->fillFromDbPk($pixel_id)) { if ($isMany) { continue; } Message::echoJsonError(__('pixel_not_found')); } if ($model->campaign_id != $campaign_id) { $model->campaign_id = $campaign_id; $isThisCampaign = false; } if (!$model->cloneModel()) { if ($isMany) { continue; } Message::echoJsonError(__('pixel_not_found')); } $newID = $newIDs[] = $model->getPkValue(); $message[] = __('pixel_cloned') . ' <a href="' . $this->controller . '/update/id=' . $newID . '">' . __('edit') . ' (ID: ' . $newID . ')</a><br>'; unset($model); } if (!$message) { Message::echoJsonError(__('pixel_not_cloned')); } $message = implode($message); $newIDs = implode(',', $newIDs); $v = array('message' => $message); if ($isThisCampaign) { $v['newid'] = $newIDs; } Message::echoJsonSuccess($v); } }
function deleteAction() { $id = AF::get($_POST, 'id', 0); $modelsID = explode(',', $id); $errors = FALSE; foreach ($modelsID as $id) { $model = new Profile(); $model->model_uset_id = $this->user->user_id; if ($model->findByPk($id)) { $model->delete($id); } else { $errors = TRUE; } if ($model->getErrors()) { $errors = TRUE; } unset($model); } if (isset($_POST['ajax'])) { AF::setJsonHeaders('json'); if ($errors) { Message::echoJsonError(__('profile_not_deleted')); } else { $countE = AF::get($_POST, 'countE', 100000); if (count($modelsID) >= $countE) { $link = AF::link(array('profiles' => 'view')); Message::echoJsonRedirect($link); } else { Message::echoJsonSuccess(__('profile_deleted')); } } } $this->redirect(); }
$soapUrl = "https://secure-wms.com/webserviceexternal/contracts.asmx"; $xml = ''; $xml = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<soap:Envelope xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\">\n<soap:Body>\n<extLoginData xmlns=\"http://www.JOI.com/schemas/ViaSub.WMS/\">\n<ThreePLKey>" . $key . "</ThreePLKey>\n<Login>" . $username . "</Login>\n<Password>" . $password . "</Password>\n<FacilityID>" . $warehouseId . "</FacilityID>\n</extLoginData>\n<orders xmlns=\"http://www.JOI.com/schemas/ViaSub.WMS/\">"; // grab the packages $sql = "\n\tSELECT \n\t\t distinct p.package_id\n\t\t, p.customer_id\n\tFROM \n\t\tpackages p\n\t\tjoin packages_orders po on po.package_id = p.package_id\n\t\tjoin orders o on o.order_id = po.order_id\n\tWHERE \n\t\tp.sent is null\n\t\tand p.fulfillment_id = ?i\n\t\t#AND FIND_IN_SET('test', `o`.`flags`)=0"; $packages = $msql->getInd('package_id', $sql, $fulfillmentModel->fulfillment_id); foreach ($packages as $p) { $package = new Package(); $package->loadFullPackage($p['package_id']); $xml .= $package->getPackage3pl(); unset($package); } $xml .= "</orders>\n<warnings xmlns=\"http://www.JOI.com/schemas/ViaSub.WMS/\">string</warnings>\n</soap:Body>\n</soap:Envelope>"; //fb($xml); $path = array('files', 'csv'); $filePath = AF::path($fulfillmentModel->csvFileName, $path, 'xml'); file_put_contents($filePath, $xml); echo $filePath . '<br><br>'; // M.Scully - disabled this by passing ?test in the url if (!isset($_GET['test'])) { // send to 3PL $headers = array("Content-type: text/xml;charset=\"utf-8\"", "Accept: text/xml", "Cache-Control: no-cache", "Pragma: no-cache", "SOAPAction: http://www.JOI.com/schemas/ViaSub.WMS/CreateOrders", "Content-length: " . strlen($xml)); //SOAPAction: your op URL // PHP cURL for https connection with auth $ch = curl_init(); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0); curl_setopt($ch, CURLOPT_URL, $soapUrl); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); //curl_setopt($ch, CURLOPT_USERPWD, $soapUser.":".$soapPassword); // username and password - declared at the top of the doc curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_ANY); curl_setopt($ch, CURLOPT_TIMEOUT, 10);
private function createReportAfidLink($data, $action, $from) { $params = array(); $FilterFields = self::$FilterFields; if ($FilterFields) { if ($this->campaign_id && $from == 'campaign') { $params['campaign_id'] = $this->campaign_id; } if ($this->AFID && $from == 'afids') { $params['AFID'] = $this->AFID; } if (isset($FilterFields['currency']) && !empty($FilterFields['currency'])) { $params['currency'] = implode(',', $FilterFields['currency']); } if (isset($FilterFields['dates']) && !empty($FilterFields['dates'])) { $params['dates'] = $FilterFields['dates']; } } $params['from'] = $from; $link = AF::link(array('reports' => $action), $params); unset($FilterFields); return "<a href='{$link}'>{$data}</a>"; }
function deleteAction() { $id = AF::get($_POST, 'id', 0); $modelsID = explode(',', $id); $errors = FALSE; foreach ($modelsID as $id) { $model = new Domain(); //$model->model_uset_id = $this->user->user_id; if ($model->findByPk($id)) { // if beforeDelete() returns an error, indicate this to the user if (!$model->delete($id)) { $errors = TRUE; } } else { $errors = TRUE; } if ($model->getErrors()) { $errors = TRUE; } unset($model); } if (isset($_POST['ajax'])) { AF::setJsonHeaders('json'); if ($errors) { Message::echoJsonError(__('domain_not_deleted')); } else { Message::echoJsonSuccess(__('domain_deleted')); } } $this->redirect(); }
private function array2str($item) { if (isset($item['visible']) && !$item['visible']) { return false; } $menuItem = new MenuItem(); $menuItem->class = isset($this->li_attributes['class']) ? $this->li_attributes['class'] : ''; if (isset($item['url'])) { $url = AF::linkArr2linkArr($item['url']); if (!$this->access->actionAccess($url)) { return false; } foreach ($item['url'] as $key => $value) { if ($this->different) { if ($key == $this->controller && $value == $this->action) { $menuItem->class .= ' active'; } } else { if ($key == $this->controller) { $menuItem->class .= ' active'; } } } } $menuItem->visible = isset($item['visible']) && !$item['visible'] ? '0' : '1'; $menuItem->label = isset($item['label']) ? $item['label'] : 'No Lable'; $menuItem->attributes = ' '; $params_url = isset($item['params_url']) ? $item['params_url'] : array(); $menuItem->url = isset($item['url']) ? AF::link($item['url'], $params_url) : '#'; if (isset($item['submenu']) && $item['submenu']) { $subMenu = array(); $active = false; foreach ($item['submenu'] as $itemSubMenu) { if (isset($itemSubMenu['url'])) { foreach ($itemSubMenu['url'] as $key => $value) { if ($key == $this->controller) { $active = true; } if ($this->different) { if ($key == $this->controller && $value == $this->action) { $active = true; } } else { if ($key == $this->controller) { $active = true; } } } } $itemS = $this->array2str($itemSubMenu); if ($itemS) { $subMenu[] = $itemS; } unset($itemS); } if (empty($subMenu)) { return false; } if ($active) { $menuItem->class .= ' active'; } $menuItem->subMenu = $subMenu; unset($subMenu); $menuItem->class .= ' dropdown'; if (isset($item['attributes']['class'])) { $item['attributes']['class'] .= 'dropdown-toggle'; } else { $item['attributes']['class'] = 'dropdown-toggle'; } } if ($item['attributes']) { $tempAttr = ''; foreach ($item['attributes'] as $key => $value) { $tempAttr .= $key . '="' . $value . '" '; } $menuItem->attributes = $tempAttr; unset($tempAttr, $key, $value); } return $menuItem; }
<div <?if($ajax){?>id="af_ajax_table"<?}?>> <form data="af_ajax_table" class="search-form" action="<?php echo AF::link(array('reports' => 'fulfillment')); ?> " method="post" onsubmit="return false;"> <?php $this->widget(new DataPicker(array('name' => 'r_dates', 'value' => array('main' => $filterFields['r_dates'], 'post' => $filterFields['r_dates_post']), 'inputHtml' => array('class' => 'input-smedium', 'placeholder' => __('filter_date'))))); ?> <select name="show_orders" class="chosen-select select-xlarge af_select_ajax"> <option value="0" <?if($filterFields['show_orders']==0){?>selected="" <?}?>><?php echo __('group_by_fulfillments'); ?> </option> <option value="1" <?if($filterFields['show_orders']==1){?>selected="" <?}?>><?php echo __('group_by_orders'); ?> </option> </select> <?if($filterFields['show_orders']==1){?> <select name="from" class="chosen-select select-xlarge af_select_ajax" data-placeholder="<?php echo __('all_type'); ?> "> <option value=""></option> <?foreach(Fulfillment::orderSType() as $itemType){?> <option value="<?php echo $itemType;
'model' => $model, )); ?> <div class="campship_hidden_campaign_id hide"><?php echo $campaign_id; ?> </div> </div> </div> <?}?> <?if($access->actionAccess('view_table')){?> <form id="taxes_search_form" data="af_ajax_table" class="search-form" action="<?php echo AF::link(array('taxes' => 'view')); ?> " method="post" onsubmit="return false;"> <select name="country_id" data-placeholder="<?php echo __('all_countries'); ?> " class="chosen-select af_select_ajax" style="width: 280px;"> <option value="" ></option> <?foreach($countries as $value){?> <option value="<?php echo $value['country_id']; ?> " <?if($filterFields['country_id'] == $value['country_id']){?>selected=""<?}?>>( <?php echo $value['country_id']; ?>
<?php $this->includeFile('_menu', array('application', 'views', 'shipping'), array('access' => $access, 'controller' => $controller, 'action' => $action, 'user' => $user)); ?> <?if($access->actionAccess('create')){?> <a class="btn btn-small" href="shipcats/create/"><i class="icon-plus"></i> <?php echo __('add_new'); ?> </a> <?}?> <?if($access->actionAccess('view_table')){?> <form data="af_ajax_table" class="search-form" action="<?php echo AF::link(array('shipcats' => 'view')); ?> " method="post" onsubmit="return false;"> <input class="input-large af-input-field" type="text" name="stext" placeholder="<?php echo __('search_text'); ?> " value="<?php echo $filterFields['stext']; ?> "> <button type="button" class="btn btn-small btn-set ajax_submit_form" ><i class="icon-search"></i> <?php echo __('search'); ?> </button> <button type="button" class="btn btn-small btn-set ajax_clear_form"><i class="icon-remove"></i> <?php echo __('clear_search');
public function getgateway_formatted() { $link = AF::link(array('gateways' => 'update'), array('id' => $this->gateway_id)); return '[<a href="' . $link . '">' . $this->gateway_id . '</a>] <a href="' . $link . '">' . $this->gateway_alias . '</a>'; }
<hr> <?if($access->actionAccess('create')){?> <a class="btn btn-small" href="<?php echo AF::link(array('templates' => 'create')); ?> "><i class="icon-plus"></i> <?php echo __('add_new'); ?> </a> <?}?> <?if($access->actionAccess('view_table')){?> <form data="af_ajax_table" class="search-form" action="<?php echo AF::link(array('templates' => 'view')); ?> " method="post" onsubmit="return false;"> <select data-placeholder="<?php echo __('all_templates'); ?> " name="template_id" data-placeholder="<?php echo __('choose_campaign'); ?> " class="chosen-select select-xlarge af_select_ajax"> <option value=""></option> <?foreach($templates as $value){?> <option value="<?php echo $value['template_id']; ?> " <?if($filterFields['template_id'] == $value['template_id']){?>selected=""<?}?>>[<?php