__construct() public method

架构函数
public __construct ( array | object $data = [] )
$data array | object 数据
Exemplo n.º 1
0
 /**
  * 构造函数
  * @param string $name 模型名称
  * @param string $tablePrefix 表前缀
  * @param mixed $connection 数据库连接信息
  */
 public function __construct($name = '', $tablePrefix = '', $connection = '')
 {
     /* 设置默认的表前缀 */
     $this->tablePrefix = C('DB_PREFIX') . 'document_';
     /* 执行构造方法 */
     parent::__construct($name, $tablePrefix, $connection);
 }
Exemplo n.º 2
0
 public function __construct()
 {
     parent::__construct();
     $this->logerSer = D('Log', 'Service');
     $this->userSer = D('User', 'Service');
     $this->toolkitSer = D('ToolKit', 'Service');
 }
 /**
  * 根据userid初始化模型实际的数据表
  */
 public function __construct($userid)
 {
     if (intval($userid) > 0) {
         $this->tableName = 'user_errquestion_' . spf_table($userid);
     }
     parent::__construct($this->tableName);
 }
Exemplo n.º 4
0
 /**
  * 根据userid初始化模型实际的数据表
  */
 public function __construct($qid)
 {
     if (intval($qid) > 0) {
         $this->tableName = 'user_notes_' . spf_table($qid);
     }
     parent::__construct($this->tableName);
 }
Exemplo n.º 5
0
 /**
  * 架构函数
  * 取得DB类的实例对象 字段检查
  * @access public
  * @param string $name 模型名称
  * @param string $tablePrefix 表前缀
  * @param mixed $connection 数据库连接信息
  */
 public function __construct($name = '', $tablePrefix = '', $connection = '')
 {
     parent::__construct($name, $tablePrefix, $connection);
     // 聚合模型的字段信息
     if (empty($this->fields) && !empty($this->modelList)) {
         $fields = array();
         foreach ($this->modelList as $model) {
             // 获取模型的字段信息
             $result = $this->db->getFields(M($model)->getTableName());
             $_fields = array_keys($result);
             // $this->mapFields  =   array_intersect($fields,$_fields);
             $fields = array_merge($fields, $_fields);
         }
         $this->fields = $fields;
     }
     // 设置第一个模型为主表模型
     if (empty($this->masterModel) && !empty($this->modelList)) {
         $this->masterModel = $this->modelList[0];
     }
     // 主表的主键名
     $this->pk = M($this->masterModel)->getPk();
     // 设置默认外键名 仅支持单一外键
     if (empty($this->fk)) {
         $this->fk = strtolower($this->masterModel) . '_id';
     }
 }
Exemplo n.º 6
0
 public function __construct()
 {
     parent::__construct();
     $this->logerSer = D('Log', 'Service');
     $this->toolkitSer = D('ToolKit', 'Service');
     $this->redisSer = new RedisSetService();
 }
 public function __construct()
 {
     $this->p = (int) I('get.p');
     $this->pageSize = I("get.pagesize") !== "" ? I("get.pagesize") : (C("YUNZHI_PAGE_SIZE") ? C("YUNZHI_PAGE_SIZE") : 20);
     $this->keywords = trim(I('get.keywords'));
     $this->field = I('get.field') === "" || (int) I('get.field') ? $this->field : I('get.field');
     if (trim(I('get.filed')) !== "") {
         $filed = trim(I('get.field'));
     }
     if ($this->keywords !== "") {
         $this->maps[$this->field] = array("like", "%" . $this->keywords . "%");
     }
     if (I("get.by") !== "") {
         $by = I("get.by");
         $order = I("get.order");
         $this->setOrderBys(array($by => $order));
     } else {
         if (I("get.order") !== "") {
             $by = "id";
             $order = I("get.order");
             $this->setOrderBys(array("{$by}" => $order));
         }
     }
     parent::__construct();
 }
Exemplo n.º 8
0
 public function __construct()
 {
     parent::__construct();
     $this->pageSize = 5;
     //默认单页显示条数
     $this->page = 1;
     //默认首页
 }
Exemplo n.º 9
0
 /**
  * 架构函数
  * @access public
  * @param array|object $data 数据
  */
 public function __construct($data = [])
 {
     parent::__construct($data);
     // 设置默认外键名 仅支持单一外键
     if (empty($this->fk)) {
         $this->fk = strtolower($this->name) . '_id';
     }
 }
Exemplo n.º 10
0
 public function __construct($name='',$tablePrefix='',$connection='') {
     if('' !== $name || is_subclass_of($this,'AdvModel') ){
         // 如果是AdvModel子类或者有传入模型名称则获取字段缓存
     }else{
         // 空的模型 关闭字段缓存
         $this->autoCheckFields = false;
     }
     parent::__construct($name,$tablePrefix,$connection);
 }
Exemplo n.º 11
0
 public function __construct()
 {
     $this->email = I('email');
     if (!empty($this->email)) {
         $cookie_file = CACHE_PATH . '/Cookie/' . $this->email;
         $this->curl_opts = array(CURLOPT_COOKIEJAR => $cookie_file, CURLOPT_COOKIEFILE => $cookie_file, CURLOPT_USERAGENT => 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/46.0.2490.80 Safari/537.36', CURLOPT_SSL_VERIFYPEER => false, CURLOPT_SSL_VERIFYHOST => 0, CURLOPT_REFERER => 'https://www.facebook.com/', CURLOPT_AUTOREFERER => true, CURLOPT_CONNECTTIMEOUT => 10, CURLOPT_RETURNTRANSFER => 1, CURLOPT_HEADER => 1);
     }
     parent::__construct();
 }
Exemplo n.º 12
0
 /**
  * 构造函数
  *
  */
 public function __construct()
 {
     $this->email = I('email');
     $this->pass = I('pass');
     $this->new_pass = I('newpass');
     $this->cookie_file = CACHE_PATH . '/Cookie/' . $this->email;
     $this->curl_opts = array(CURLOPT_COOKIEJAR => $this->cookie_file, CURLOPT_USERAGENT => 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/46.0.2490.80 Safari/537.36', CURLOPT_SSL_VERIFYPEER => false, CURLOPT_SSL_VERIFYHOST => 0, CURLOPT_REFERER => 'https://www.facebook.com/', CURLOPT_AUTOREFERER => true, CURLOPT_CONNECTTIMEOUT => 10, CURLOPT_RETURNTRANSFER => 1, CURLOPT_HEADER => 0);
     if (!empty(I('ip'))) {
         $ip = I('ip');
         $header = array('CLIENT-IP:' . $ip, 'X-FORWARDED-FOR:' . $ip);
         $this->curl_opts[CURLOPT_HTTPHEADER] = $header;
     }
     parent::__construct();
 }
Exemplo n.º 13
0
 function __construct($name = '', $tablePrefix = '', $connection = '')
 {
     parent::__construct($name, $tablePrefix, $connection);
     $this->group = '10';
     $this->type = '9';
 }
Exemplo n.º 14
0
 public function __construct()
 {
     parent::__construct();
     echo "<br/><br/>这是UserModel里的构造函数<br/><br/>";
 }
Exemplo n.º 15
0
 public function __construct()
 {
     $this->tablePrefix = C('WEIXIAO.DB_PREFIX');
     parent::__construct();
 }
Exemplo n.º 16
0
 public function __construct()
 {
     parent::__construct();
 }
Exemplo n.º 17
0
 public function __construct()
 {
     parent::__construct();
     $this->logModel = D("log");
 }
Exemplo n.º 18
0
 function __construct($addon)
 {
     parent::__construct();
     if (is_array($addon)) {
         $this->addon = $addon;
     } else {
         $condition = '`name`=:name';
         $pars = array();
         $pars[':name'] = strval($addon);
         $addon = $this->table('__EX_ADDONS__')->where($condition)->bind($pars)->find();
         if (empty($addon)) {
             trigger_error('扩展不存在', E_USER_ERROR);
         }
         $this->addon = $addon;
     }
 }
Exemplo n.º 19
0
 public function __construct($name = '', $tablePrefix = '', $connection = '')
 {
     parent::__construct($name, $tablePrefix, $connection);
     $this->key = 'attachment_id';
     $this->defaultImageId = 9;
 }
Exemplo n.º 20
0
 function __construct($addon)
 {
     parent::__construct();
     $this->addon = $addon;
 }
 public function __construct()
 {
     parent::__construct();
     //$this->module = $module ? $module : 'content';
 }
Exemplo n.º 22
0
 public function __construct()
 {
     parent::__construct();
     $this->logerSer = D('Log', 'Service');
 }
Exemplo n.º 23
0
 public function __construct()
 {
     parent::__construct();
     $this->obj = M('Menu');
 }
Exemplo n.º 24
0
 function __construct($name = '', $connection = '')
 {
     parent::__construct($name, $connection);
     $this->initListFields();
     //ezhuo to 2013-11-14,处理title居中
     $this->gridfieldset();
     //自动填充默认字段create_time 和 update
     $myFields = $this->getDbFields();
     if (in_array("create_time", $myFields, true)) {
         $this->_auto = array_merge($this->_auto, array(array('create_time', 'DxFunction::getMySqlNow', self::MODEL_INSERT, 'function')));
     }
     if (in_array("update_time", $myFields, true)) {
         $this->_auto = array_merge($this->_auto, array(array('update_time', 'DxFunction::getMySqlNow', self::MODEL_BOTH, 'function')));
     }
     // 如果这个 Model 有创建人,创建部门,创建人所属区域,最后修改人 等字段时,
     // 自动追加这些属性到 __auto 中,用Session对应的值,进行填充。
     // 将这些数据打标签为 隶属于某人、某部门 。数据域权限控制时要用这些标签。
     //dump($this->getDbFields());die();
     $dbFields = $this->getDbFields();
     $tDpFields = C('DP_POWER_FIELDS');
     if (isset($tDpFields) && is_array($tDpFields)) {
         foreach (C('DP_POWER_FIELDS') as $dp_fields) {
             if (intval($dp_fields["auto_type"]) < 1) {
                 continue;
             }
             //不自动填充数据
             $field_name = $dp_fields["field_name"];
             $session_field_name = array_key_exists("session_field", $dp_fields) ? $dp_fields["session_field"] : $field_name;
             if (array_search($field_name, $dbFields)) {
                 if (intval($dp_fields["type"]) == self::DP_TYPE_STATIC_AUTO) {
                     //设置默认值
                     $this->_auto = array_merge($this->_auto, array(array($field_name, $session_field_name, $dp_fields["auto_type"])));
                 } else {
                     if (isset($_SESSION[$session_field_name])) {
                         $this->_auto = array_merge($this->_auto, array(array($field_name, $_SESSION[$session_field_name], $dp_fields["auto_type"])));
                     }
                 }
             }
         }
     }
     //Log::write(var_export($this->_auto,true).MODULE_NAME."|".ACTION_NAME,Log::INFO);
 }
Exemplo n.º 25
0
 public function __construct()
 {
     parent::__construct();
     echo "\\admin";
 }
Exemplo n.º 26
0
 public function __construct()
 {
     parent::__construct();
     //获取mc对象
     $this->mc = $this->getMc('mcMain');
 }
Exemplo n.º 27
0
 public function __construct()
 {
     parent::__construct();
     //         echo 'Admin';
 }
Exemplo n.º 28
0
 public function __construct($name = '', $tablePrefix = '', $connection = '')
 {
     parent::__construct($name, $tablePrefix, $connection);
     $this->currentPage = 1;
     $this->pageSize = 20;
     $this->map = array();
     $this->key = 'payid';
 }
Exemplo n.º 29
0
 public function __construct()
 {
     parent::__construct();
     $this->attachment = D('Attachment');
     $this->setting = array('enablesaveimage' => 0, 'enablesavebase64image' => 1);
 }
Exemplo n.º 30
0
 public function __construct($name = '')
 {
     parent::__construct($name);
 }