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


PHP APP::uses方法代码示例

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


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

示例1: beforeFilter

<?php

APP::uses('AppController', 'Controller');
App::uses('ExcelProcessor', 'Lib');
App::import('Vendor', 'Classes/PHPExcel.php');
App::import('Vendor', 'PHPExcel_IOFactory', array('file' => 'Classes/PHPExcel/IOFactory.php'));
App::import('Vendor', 'PHPExcelReader', array('file' => 'Classes/PHPExcel/Reader/Excel2007.php'));
App::import('Vendor', 'PHPExcelWriter', array('file' => 'Classes/PHPExcel/Writer/Excel2007.php'));
class TeamleadersController extends AppController
{
    public $uses = array("Role", "User", "Superadmin", "Manager", "Teamleader", "Telecaller", "Allocationmaster");
    public $paginate = array('limit' => 25, 'conditions' => array('status' => '1'), 'order' => array('User.username' => 'asc'));
    public function beforeFilter()
    {
        parent::beforeFilter();
    }
    public function isAuthorized($user)
    {
        if ($user['role'] === 'TeamLeader') {
            if ($this->action === 'index' || $this->action === 'add' || $this->action === 'edit' || $this->action === 'delete' || $this->action === 'upload_excel') {
                return true;
            }
        } else {
            return false;
        }
    }
    public function index()
    {
        $this->paginate = array('limit' => 20, 'conditions' => array('User.role' => 'TeamLeader'), 'order' => array('User.username' => 'asc'));
        $users = $this->paginate('User');
        $this->set(compact('users'));
开发者ID:Gaurav-GD,项目名称:cambist,代码行数:31,代码来源:TeamleadersController.php

示例2: beforeSave

<?php

/**
 * Model class for users database
 * Uses Containable behaviour.
 */
APP::uses('AuthComponent', 'Controller/Component');
class User extends AppModel
{
    public $name = 'User';
    public $cacheQueries = TRUE;
    //Cache for single request.
    public $actsAs = array('Containable');
    //Associations with other models
    public $hasMany = array('Car' => array('className' => 'Car', 'foreignKey' => 'user_id', 'conditions' => array('Car.deleted' => 0), 'order' => '', 'limit' => '', 'offset' => '', 'dependent' => FALSE, 'exclusive' => FALSE, 'finderQuery' => ''));
    //Validation rules
    public $validate = array('given_name' => array('rule' => 'notEmpty', 'required' => FALSE, 'allowEmpty' => FALSE, 'on' => NULL, 'message' => 'Please provide a given name!'), 'surname_name' => array('rule' => 'notEmpty', 'required' => FALSE, 'allowEmpty' => FALSE, 'on' => NULL, 'message' => 'Please provide a surname!'), 'password' => array('provided' => array('rule' => 'notEmpty', 'required' => FALSE, 'allowEmpty' => FALSE, 'on' => NULL, 'message' => 'Please provide a password!'), 'matches' => array('rule' => array('fieldsMatch', 'password_confirmation'), 'required' => FALSE, 'allowEmpty' => FALSE, 'on' => NULL, 'message' => 'Passwords do not match!')), 'email' => array('validEmail' => array('rule' => 'email', 'required' => FALSE, 'allowEmpty' => FALSE, 'on' => NULL, 'message' => 'Please provide a valid email address!'), 'uniqueEmail' => array('rule' => 'isUnique', 'required' => FALSE, 'allowEmpty' => FALSE, 'on' => NULL, 'message' => 'This email exists already!')));
    /**
     * Hash passwords
     * @see Model::beforeSave()
     */
    public function beforeSave($options = array())
    {
        if (!empty($this->data[$this->alias]['password'])) {
            $this->data[$this->alias]['password'] = AuthComponent::password($this->data[$this->alias]['password']);
        }
        return TRUE;
    }
    /**
     * Custom validation rule for matching fields.
     * @param array $check the value of the field to be checked. array('field' => 'value')
开发者ID:rawroland,项目名称:Cars-Test,代码行数:31,代码来源:User.php

示例3:

<?php

App::uses('File', 'Utility');
APP::uses('Folder', 'Utility');
/**
 * Extensions Locales Controller
 *
 * PHP version 5
 *
 * @category Controller
 * @package  Croogo
 * @version  1.0
 * @author   Fahad Ibnay Heylaal <contact@fahad19.com>
 * @license  http://www.opensource.org/licenses/mit-license.php The MIT License
 * @link     http://www.croogo.org
 */
class ExtensionsLocalesController extends ExtensionsAppController
{
    /**
     * Controller name
     *
     * @var string
     * @access public
     */
    public $name = 'ExtensionsLocales';
    /**
     * Models used by the Controller
     *
     * @var array
     * @access public
     */
开发者ID:laiello,项目名称:plankonindia,代码行数:31,代码来源:ExtensionsLocalesController.php

示例4: finalizeRules

<?php

APP::uses("Market", "Model");
App::uses("TraitCountry", "Model");
App::uses('AuditableModel', 'Model');
class Phone extends AuditableModel
{
    const ORDER = 0;
    const MAIN = 1;
    const SMS = 2;
    public $name = 'Phone';
    public $validate = array('phone' => array('rule' => array('phone', '/^([0-9\\s\\-\\+\\(\\)]*)$/'), 'message' => 'Please supply a valid phone number.'));
    public function finalizeRules()
    {
        foreach (array("phone") as $field) {
            foreach ($this->validator()->getField($field)->getRules() as $rule) {
                $rule->required = TRUE;
                break;
                //I only need required on one of the rules
            }
        }
    }
    public function beforeValidate($options = array())
    {
        // market touch point
        $trait = new TraitCountry();
        $validator = $this->validator();
        $format = $trait->getTrait($this->getMarketId(), 'phone_format');
        //use Market Traits to validate city.
        if (!empty($format)) {
            $num = $trait->getTrait($this->getMarketId(), 'zip_qualifier');
开发者ID:kameshwariv,项目名称:testexample,代码行数:31,代码来源:Phone.php

示例5: array

<?php

/* 
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
APP::uses('AppModel', 'Model');
class Teamleader extends AppModel
{
    public $actsAs = array('Containable');
    // public $primaryKey = "user_id";
    public $belongsTo = array('User' => array('className' => 'User', 'foreignKey' => 'id', 'conditions' => '', 'fields' => '', 'order' => ''), 'Manager' => array('className' => 'Manager', 'foreignKey' => 'manager_id', 'conditions' => '', 'fields' => '', 'order' => ''));
    public $hasMany = array('Telecaller' => array('className' => 'Telecaller', 'foreign_key' => 'teamleader_id', 'conditions' => '', 'fields' => '', 'order' => ''));
}
开发者ID:Gaurav-GD,项目名称:cambist,代码行数:15,代码来源:Teamleader.php

示例6: __construct

 /**
  * コンストラクタ
  */
 public function __construct()
 {
     parent::__construct();
     APP::uses("TmhkConverter", "TokushuMojiHenkanKun.Lib");
 }
开发者ID:kaburk,项目名称:TokushuMojiHenkanKun,代码行数:8,代码来源:TokushuMojiHenkanKunModelEventListener.php

示例7: UserService

 function UserService()
 {
     APP::uses("User", "UserManager.Model");
     $this->User = new User();
 }
开发者ID:khaled-saiful-islam,项目名称:zen_v1.0,代码行数:5,代码来源:UserService.php


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