本文整理汇总了PHP中AF类的典型用法代码示例。如果您正苦于以下问题:PHP AF类的具体用法?PHP AF怎么用?PHP AF使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了AF类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: ordersAction
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));
}
示例2: welcomeAction
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));
}
示例3: viewAction
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));
}
示例4: deleteAction
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();
}
示例5: createBreadCrumbs
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);
}
示例6: resetAction
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());
}
示例7: __construct
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);
}
示例8: getContent
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();
}
示例9: fillFromDatabase
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);
}
}
示例10: load
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;
}
示例11: before
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;
}
示例12: generalAction
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());
}
示例13: openAction
/**
* 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));
}
示例14: saveCsvCustom
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;
}
示例15: createFilter
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);
}
}
}