当前位置: 首页>>代码示例>>PHP>>正文


PHP AF::userAccess方法代码示例

本文整理汇总了PHP中AF::userAccess方法的典型用法代码示例。如果您正苦于以下问题:PHP AF::userAccess方法的具体用法?PHP AF::userAccess怎么用?PHP AF::userAccess使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在AF的用法示例。


在下文中一共展示了AF::userAccess方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: 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);
         }
     }
 }
开发者ID:,项目名称:,代码行数:21,代码来源:

示例2: cloneAction

 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);
     }
 }
开发者ID:,项目名称:,代码行数:62,代码来源:

示例3: getnext_product_info_formatted

    public function getnext_product_info_formatted()
    {
        if (!$this->next_product_id) {
            return '';
        }
        if (!AF::userAccess()->actionAccess(array('products', 'update'))) {
            return '[' . $this->next_product_id . '] ' . $this->next_product_name;
        }
        $olink = AF::link(array('orders' => 'view'), array('product' => $this->next_product_id));
        $plink = AF::link(array('products' => 'update'), array('id' => $this->next_product_id));
        return '[<a title="Search Orders by Product ID" data-toggle="atooltip" href="' . $olink . '">' . $this->next_product_id . '</a>] 
		<a title="View Product" data-toggle="atooltip" href="' . $plink . '">' . $this->next_product_name . '</a>';
    }
开发者ID:,项目名称:,代码行数:13,代码来源:

示例4: __

?>
</label>
        <div class="controls">
            <select id="pixels_select_pixel_type" name="pixel_type" class="chosen-select select-xlarge" >
                <option value=""><?php 
echo __('choose');
?>
</option>
                <option value="postback" <?if('postback' == $model->pixel_type){?>selected=""<?}?>>postback</option>
                <option value="iframe" <?if('iframe' == $model->pixel_type){?>selected=""<?}?>>iframe</option>
            </select>
            <span class="help-inline"></span>
        </div>
    </div>

    <?$ff=AF::userAccess()->hasRestrictions('aff_id');?>
    <?if(!$ff){?>
    <div class="control-group">
        <div class="controls">
            <label class="checkbox">
                <input id="afid_all_checked" type="checkbox" name="aff_id_ALL" value="1" <?if(!$model->aff_id){?>checked="yes"<?}?>> <?php 
echo __('all_afid');
?>
            </label>
            <span class="help-inline"></span>
        </div>
    </div>
    <?}?>

    <div class="control-group <?if(!$model->aff_id && !$ff){?>hide<?}?>" id="div_afid_id" >
        <label class="control-label"><?php 
开发者ID:,项目名称:,代码行数:31,代码来源:

示例5: getRCampaigns

 public function getRCampaigns()
 {
     $where = $this->unsetWhereKey('c_campaign_id');
     $sql = "SELECT op.`campaign_id`, c.`campaign_name`\n                FROM `prospects` AS op\n                JOIN `campaigns` AS c ON op.`campaign_id` = c.`campaign_id`\n\t\t\t\tLEFT JOIN profiles as pr USING(profile_id) {$this->join}\n\t\t\t\t/*LEFT JOIN gateways as g USING(gateway_id)*/\n                WHERE ?p AND `prospect_id` IS NULL and c.attach != 1\n                UNION\n                SELECT op.`campaign_id`, c.`campaign_name`\n                FROM `orders` AS op\n                JOIN `campaigns` AS c ON op.`campaign_id` = c.`campaign_id`\n                LEFT JOIN profiles as pr USING(profile_id) {$this->join}\n\t\t\t\t/*LEFT JOIN gateways as g USING(gateway_id)*/\n                WHERE ?p and c.attach != 1 AND op.`status` IN ('ok', 'sent', 'shipped', 'returned', 'void') AND op.`billing_cycle` = 0 AND FIND_IN_SET('test',`flags`)=0\n                ORDER BY `campaign_id` DESC";
     $result = self::$_msql->getAll($sql, $where, $where);
     return AF::userAccess()->array2RestrictionArray('campaign_id', $result);
 }
开发者ID:,项目名称:,代码行数:7,代码来源:

示例6: createCustomFilter

 protected static function createCustomFilter($params)
 {
     // Mysql connect
     $msql = SafeMySQL::getInstance();
     $whereArray = array();
     $joinArray = array();
     $restrictionsFields = array(0 => array('campaign_id', 'aff_id'));
     // this is the search conditions
     if ($params['dates_post'] !== null) {
         $dates = explode('-', $params['dates_post']);
         if (isset($dates[0]) && isset($dates[1])) {
             $dateStartT = explode('.', $dates[0]);
             $dateStart = array_reverse($dateStartT);
             $dateStart = implode('-', $dateStart);
             $dateFinishT = explode('.', $dates[1]);
             $dateFinish = array_reverse($dateFinishT);
             $dateFinish = implode('-', $dateFinish);
             $whereArray['dates_post'] = $msql->parse("AND DATE(o.`created`) BETWEEN ?s AND ?s", $dateStart, $dateFinish);
         }
         unset($dateStartT, $dateFinishT);
     }
     if ($params['order_id'] !== null) {
         $ids = explode(',', $params['order_id']);
         $whereArray['order_id'] = $msql->parse("AND o.`order_id` IN(?a)", $ids);
         // if search by id, another search fields doesn't counted
         return self::returnSearchCreater($whereArray, $joinArray, array('order_id', 'page'));
     }
     if ($params['aff_id'] || in_array('aff_id', $restrictionsFields[0])) {
         $IDs = AF::userAccess()->getRestrictionSearchFields('aff_id', $params['aff_id']);
         if ($IDs) {
             $whereArray['aff_id'] = $msql->parse("AND o.`aff_id` IN (?a)", $IDs);
         }
     }
     if ($params['ip'] !== null) {
         $whereArray['ip'] = $msql->parse("AND o.`ip` = ?s", ip2long($params['ip']));
     }
     if ($params['billing_cycle'] !== null) {
         $billingCycle = (int) $params['billing_cycle'];
         if ($billingCycle >= 0) {
             $whereArray['billing_cycle'] = $msql->parse("AND o.`billing_cycle` = ?i", $billingCycle);
         }
     }
     if ($params['tracking_number'] !== null) {
         $whereArray['tracking_number'] = $msql->parse("AND at.`tracking_number` = ?i", (int) $params['tracking_number']);
         $joinArray['attempts'] = "LEFT JOIN `attempts` as at USING(`order_id`)";
     }
     if ($params['status']) {
         $whereArray['status'] = $msql->parse("AND o.`status` IN (?a)", $params['status']);
     }
     if ($params['campaign_id'] || in_array('campaign_id', $restrictionsFields[0])) {
         $campaignsID = AF::userAccess()->getRestrictionSearchFields('campaign_id', $params['campaign_id']);
         if ($campaignsID) {
             $whereArray['campaign_id'] = $msql->parse("AND o.`campaign_id` IN (?a)", $campaignsID);
         }
     }
     //Use in search by product
     $productSearchAndWhere = '';
     if ($params['recurring_orders'] !== null) {
         $whereArray['recurring_orders'] = "AND o.`status` IN ('ok','sent','shipped')";
         if ($params['product_id']) {
             $productSearchAndWhere = "AND FIND_IN_SET('recurring', `flags`)>0";
         } else {
             $whereArray['product'] = "AND o.`order_id` IN (\n                    SELECT DISTINCT `order_id`\n                    FROM `orders_products`\n                    WHERE FIND_IN_SET('recurring', `flags`)>0\n                )";
         }
     }
     if ($params['pending_recurring'] !== null) {
         $whereArray['recurring_orders'] = "AND o.`status` IN ('ok','sent','shipped')";
         if ($params['product_id']) {
             $productSearchAndWhere = "AND (FIND_IN_SET('recurring', `flags`)>0 and `recurring_next` >= now())";
         } else {
             $whereArray['product'] = "AND o.`order_id` IN (\n                    SELECT DISTINCT `order_id`\n                    FROM `orders_products`\n                    WHERE FIND_IN_SET('recurring', `flags`)>0 and `recurring_next` >= now()\n                )";
         }
     }
     if ($params['product_id']) {
         $whereArray['product_id'] = $msql->parse("AND o.`order_id` IN (\n                SELECT DISTINCT `order_id`\n \t            FROM `orders_products`\n \t            WHERE `product_id` IN (?a)\n \t            {$productSearchAndWhere}\n            )", $params['product_id']);
     }
     if ($params['country_id'] !== null) {
         $whereArray['country_id'] = $msql->parse("AND c.`country_id` = ?s", $params['country_id']);
         $joinArray['campaigns'] = "LEFT JOIN `campaigns` as c USING(`campaign_id`)";
     }
     if ($params['method_id'] !== null) {
         $whereArray['method_id'] = $msql->parse("AND p.`method_id` = ?i", (int) $params['method_id']);
         $joinArray['payments'] = "LEFT JOIN `payments` as p USING(`payment_id`)";
     }
     if ($params['num2'] !== null) {
         $whereArray['num2'] = $msql->parse("AND p.`num2` = ?i", (int) $params['num2']);
         $joinArray['payments'] = "LEFT JOIN `payments` as p USING(`payment_id`)";
     }
     if ($params['num3'] !== null) {
         $whereArray['num3'] = $msql->parse("AND p.`num3` = ?i", (int) $params['num3']);
         $joinArray['payments'] = "LEFT JOIN `payments` as p USING(`payment_id`)";
     }
     if ($params['pixel_fired'] !== null) {
         $whereArray['pixel_fired'] = "AND o.`pixel_fired` != 0";
     }
     // Search By customer
     $customerSearchWhereArray = array();
     $customerSearchJoinArray = array();
     if ($params['customer_id'] !== null) {
         $customerSearchWhereArray[] = $msql->parse("AND `customer_id` = ?i", $params['customer_id']);
//.........这里部分代码省略.........
开发者ID:,项目名称:,代码行数:101,代码来源:

示例7: getCampaignsCountOrdersR

 public function getCampaignsCountOrdersR()
 {
     $where = $this->unsetWhereKey('campaign_id');
     $unionSelect = '';
     if (!empty($this->searchFields['campaign_id'])) {
         $tempArray = explode(',', $this->searchFields['campaign_id']);
         foreach ($tempArray as $value) {
             $unionSelect .= " UNION SELECT {$value},0";
         }
     }
     $sql = "SELECT  c.`url`,\n                        c.`campaign_id`,\n                        c.`campaign_name`,\n                        COUNT(DISTINCT c.`campaign_id`) as count\n                FROM `orders` o\n                JOIN `campaigns` as c ON c.`campaign_id` = o.`campaign_id`\n\t\t\t\tJOIN `profiles_gateways` as pg ON c.`profile_id` = pg.`profile_id`\n                JOIN `gateways` as g ON pg.`gateway_id` = g.`gateway_id`\n                WHERE ?p\n                GROUP BY c.`campaign_id`\n                ORDER BY c.`campaign_id` DESC";
     $result = self::$_msql->getAll($sql, $where);
     return AF::userAccess()->array2RestrictionArray('campaign_id', $result);
 }
开发者ID:,项目名称:,代码行数:14,代码来源:

示例8: findAllInArray

 public function findAllInArray($turn = false)
 {
     $result = null;
     if ($this->isCache) {
         $cacheID = $this->modelName . '_get_all_in_array';
         $result = AF::cache()->get($cacheID);
     }
     if (!$result) {
         // hack for Templates class
         if ($this->modelName == 'template') {
             $sql = "SELECT template_id, template_name, body_subject\n\t\t\t\t\tFROM ?n\n\t\t\t\t\tORDER BY ?s DESC";
         } else {
             $sql = "SELECT *\n\t\t\t\t\tFROM ?n\n\t\t\t\t\tORDER BY ?s DESC";
         }
         $pks = $this->getPrimaryField();
         if (!is_array($pks)) {
             $pks = array($pks);
         }
         $resultTemp = self::$_msql->getAll($sql, $this->tableName(), implode(',', $pks));
         $result = array();
         foreach ($resultTemp as $item) {
             $keysArray = array();
             foreach ($pks as $k) {
                 $keysArray[] = $item[$k];
             }
             $key = implode('_', $keysArray);
             $result[$key] = $item;
         }
         if ($this->isCache) {
             $data = serialize($result);
             if (strlen($data) < 1000000) {
                 AF::cache()->set($cacheID, $result);
             }
         }
     }
     if ($this->_isRestrictions) {
         $pks = $this->getPrimaryField();
         if (is_array($pks)) {
             $pks = implode('_', $pks);
         }
         $f = AF::userAccess()->getRestrictionBySearch($pks);
         if ($f) {
             foreach ($result as $k => $v) {
                 if (!in_array($k, $f[$pks])) {
                     unset($result[$k]);
                 }
             }
         }
     }
     return $turn ? array_reverse($result) : $result;
 }
开发者ID:,项目名称:,代码行数:51,代码来源:

示例9: getCardTypeReportCampaigns

 public function getCardTypeReportCampaigns()
 {
     $where = $this->unsetWhereKey('campaign_id');
     $sql = "SELECT `o`.`campaign_id`, `c`.`campaign_name`\n                FROM `orders` as `o`\n                JOIN `payments` as `pn` USING (`payment_id`)\n                JOIN `campaigns` as `c` USING (`campaign_id`)\n                JOIN `gateways` as `g` ON `o`.`gateway_id` = `g`.`gateway_id`\n\t\t\t\tJOIN `systems` as s USING (`system_code`)\n                WHERE ?p               \n                GROUP BY `o`.`campaign_id`\n                ORDER BY `o`.`campaign_id` DESC";
     //AND s.`system_code`='pn'
     //AND `p`.`shippable` > 0
     $result = self::$_msql->getAll($sql, $where);
     return AF::userAccess()->array2RestrictionArray('campaign_id', $result);
 }
开发者ID:,项目名称:,代码行数:9,代码来源:


注:本文中的AF::userAccess方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。