當前位置: 首頁>>代碼示例>>PHP>>正文


PHP model函數代碼示例

本文整理匯總了PHP中model函數的典型用法代碼示例。如果您正苦於以下問題:PHP model函數的具體用法?PHP model怎麽用?PHP model使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。


在下文中一共展示了model函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: _initialize

 /**
  * 模塊初始化,獲取當前用戶管理的應用
  */
 public function _initialize()
 {
     $this->appList = model('App')->getManageApp($this->mid);
     if (empty($this->appList)) {
         $this->error(L('PUBLIC_NO_FRONTPLATFORM_PERMISSION'));
     }
 }
開發者ID:medz,項目名稱:thinksns-4,代碼行數:10,代碼來源:ManageAction.class.php

示例2: render

 /**
  * 渲染分享發布框模板
  * @example
  * $data['send_type'] string 分享發送類型
  * $data['app_name'] string 發布分享所在的應用名稱
  * $data['initHtml'] string 發布分享框中的默認內容
  * $data['cancomment'] integer 是否可以評論 
  *$data['channelID']  發布到某個頻道的id
  * @param array $data 發布分享框的配置參數
  * @return string 渲染後的模板內容
  */
 public function render($data)
 {
     $var = array();
     //頻道id
     $var['channelID'] = $data['channelID'];
     $var['initHtml'] = '';
     $var['post_event'] = 'post_group_feed';
     $var['cancomment'] = 0;
     is_array($data) && ($var = array_merge($var, $data));
     !$var['send_type'] && ($var['send_type'] = 'send_weibo');
     $weiboSet = model('Xdata')->get('admin_Config:feed');
     $var['initNums'] = $weiboSet['weibo_nums'];
     $var['weibo_type'] = $weiboSet['weibo_type'];
     $var['weibo_premission'] = $weiboSet['weibo_premission'];
     !$var['type'] && ($var['type'] = 'post');
     !$var['app_name'] && ($var['app_name'] = 'public');
     !$var['prompt'] && ($var['prompt'] = '轉發成功');
     $var['time'] = $_SERVER['REQUEST_TIME'];
     $var['topicHtml'] = t($data['topicHtml']);
     // 獲取安裝的應用列表
     $var['hasChannel'] = model('App')->isAppNameOpen('channel');
     // 權限控製
     $type = array('face', 'at', 'image', 'video', 'file', 'topic', 'contribute');
     foreach ($type as $value) {
         !isset($var['actions'][$value]) && ($var['actions'][$value] = true);
     }
     // 渲染模版
     $content = $this->renderFile(dirname(__FILE__) . "/SendGroupWeibo.html", $var);
     self::$rand++;
     unset($var, $data);
     // 輸出數據
     return $content;
 }
開發者ID:omusico,項目名稱:ThinkSNS-4,代碼行數:44,代碼來源:SendGroupWeiboWidget.class.php

示例3: weibo

 public function weibo()
 {
     // 解析參數
     $_REQUEST['param'] = unserialize(urldecode($_REQUEST['param']));
     $active_field = $_REQUEST['param']['active_field'] == 'title' ? 'title' : 'body';
     $this->assign('has_status', $_REQUEST['param']['has_status']);
     $this->assign('is_success_status', $_REQUEST['param']['is_success_status']);
     $this->assign('status_title', t($_REQUEST['param']['status_title']));
     // 解析模板(統一使用模板的body字段)
     $_REQUEST['data'] = unserialize(urldecode($_REQUEST['data']));
     $content = model('Template')->parseTemplate(t($_REQUEST['tpl_name']), array($active_field => $_REQUEST['data']));
     // 設置微博發布框的權限
     $type = array('at', 'image', 'video', 'file', 'contribute');
     $actions = array();
     foreach ($type as $value) {
         $actions[$value] = false;
     }
     $this->assign('actions', $actions);
     $this->assign('title', $content['title']);
     $this->assign('initHtml', $content['body']);
     $this->assign('content', h($content[$active_field]));
     $this->assign('source', $_REQUEST['data']['source']);
     $this->assign('sourceUrl', $_REQUEST['data']['url']);
     $this->assign('type', $_REQUEST['data']['type']);
     $this->assign('type_data', $_REQUEST['data']['type_data']);
     $this->assign('button_title', t(urldecode($_REQUEST['button_title'])));
     $this->assign('addon_info', urldecode($_REQUEST['addon_info']));
     $this->display();
 }
開發者ID:yang7hua,項目名稱:hunshe,代碼行數:29,代碼來源:WidgetAction.class.php

示例4: setConfig

 /**
  * Sets a configuration value - updates if it exists otherwise insert.
  * @param string $key
  * @param string $value
  * @param integer $user_id
  */
 public function setConfig($key = false, $value = false, $user_id = NULL)
 {
     $new_rc = array('current_value' => $value, 'config_key' => $key, 'user_id' => $user_id);
     $cfg_model = model()->open('config');
     $cfg = $this->configRecord($key, $user_id);
     return is_array($cfg) ? $cfg_model->update($new_rc, $cfg['id']) : $cfg_model->insert($new_rc);
 }
開發者ID:viveleroi,項目名稱:AspenMSM,代碼行數:13,代碼來源:Settings.php

示例5: index

 /**
  * 我的收藏頁麵
  */
 public function index()
 {
     $map['uid'] = $GLOBALS['ts']['uid'];
     $weiboSet = model('Xdata')->get('admin_Config:feed');
     $this->assign($weiboSet);
     // TODO:後續可能由表中獲取語言KEY
     $d['tabHash'] = array('feed' => L('PUBLIC_WEIBO'));
     $d['tab'] = model('Collection')->getCollTab($map);
     $this->assign($d);
     // 安全過濾
     $t = t($_GET['t']);
     !empty($t) && ($map['source_table_name'] = $t);
     $key = t($_POST['collection_key']);
     if ($key === '') {
         $list = model('Collection')->getCollectionList($map, 20);
     } else {
         $list = model('Collection')->searchCollections($key, 20);
         $this->assign('collection_key', $key);
         $this->assign('jsonKey', json_encode($key));
     }
     $this->assign($list);
     $this->setTitle(L('PUBLIC_COLLECTION_INDEX'));
     // 我的收藏
     // 是否有返回按鈕
     $this->assign('isReturn', 1);
     // 獲取用戶統計信息
     $userData = model('UserData')->getUserData($GLOBALS['ts']['mid']);
     $this->assign('favoriteCount', $userData['favorite_count']);
     $userInfo = model('User')->getUserInfo($this->mid);
     $this->setTitle('我的收藏');
     $this->setKeywords($userInfo['uname'] . '的收藏');
     $this->display();
 }
開發者ID:lyhiving,項目名稱:icampus,代碼行數:36,代碼來源:CollectionAction.class.php

示例6: doSwitch

 public function doSwitch()
 {
     global $_W, $_GPC;
     $m = array_merge($_W['modules']['userapi'], $_W['account']['modules'][$_W['modules']['userapi']['mid']]);
     $cfg = $m['config'];
     if ($_W['ispost']) {
         $rids = explode(',', $_GPC['rids']);
         if (is_array($rids)) {
             $cfg = array();
             foreach ($rids as $rid) {
                 $cfg[intval($rid)] = true;
             }
             $this->saveSettings($cfg);
         }
         exit;
     }
     require model('rule');
     $rs = rule_search("weid = 0 AND module = 'userapi' AND `status`=1");
     $ds = array();
     foreach ($rs as $row) {
         $reply = pdo_fetch('SELECT * FROM ' . tablename($this->tablename) . ' WHERE `rid`=:rid', array(':rid' => $row['id']));
         $r = array();
         $r['title'] = $row['name'];
         $r['rid'] = $row['id'];
         $r['description'] = $reply['description'];
         $r['switch'] = $cfg[$r['rid']] ? ' checked="checked"' : '';
         $ds[] = $r;
     }
     include $this->template('switch');
 }
開發者ID:yunsite,項目名稱:my-we7,代碼行數:30,代碼來源:module.php

示例7: edit

 /**
  * 編輯活動
  */
 public function edit()
 {
     $id = I('id');
     if (IS_POST) {
         $data = I('data');
         if ($_FILES['act_banner']['name']) {
             $result = $this->ectouchUpload('act_banner', 'banner_image');
             if ($result['error'] > 0) {
                 $this->message($result['message'], NULL, 'error');
             }
             /* 生成banner鏈接 */
             $data2['act_banner'] = substr($result['message']['act_banner']['savepath'], 2) . $result['message']['act_banner']['savename'];
             $this->model->table('touch_activity')->data($data2)->where('act_id=' . $id)->update();
         }
         $this->message(L('edit_favourable_ok'), url('index'));
     }
     /* 查詢附表信息 */
     $touch_result = $this->model->table('touch_activity')->where('act_id=' . $id)->find();
     $favourable = model('GoodsBase')->favourable_info($id);
     /* 附表信息不存在則生成 */
     if (empty($touch_result)) {
         $data['act_id'] = $id;
         $this->model->table('touch_activity')->data($data)->insert();
     } else {
         $favourable['act_banner'] = $touch_result['act_banner'];
         $favourable['act_content'] = html_out($touch_result['act_content']);
     }
     /* 模板賦值 */
     $this->assign('favourable', $favourable);
     $this->assign('ur_here', L('edit_favourable'));
     $this->assign('action_link', array('text' => L('06_goods_brand_list'), 'href' => url('index')));
     $this->display();
 }
開發者ID:noikiy,項目名稱:shop-3,代碼行數:36,代碼來源:FavourableController.class.php

示例8: getUnreadCount

 /**
  * 用戶的通知統計數目
  * @return mix 通知統計狀態和數目
  */
 public function getUnreadCount()
 {
     $count = model('UserCount')->getUnreadCount($this->mid);
     $data['status'] = 1;
     $data['data'] = $count;
     echo json_encode($data);
 }
開發者ID:medz,項目名稱:thinksns-4,代碼行數:11,代碼來源:UserCountAction.class.php

示例9: search

 public function search()
 {
     if (empty($_REQUEST["start_time"])) {
         $datas['start_time'] = 0;
     } else {
         $datas['start_time'] = $_REQUEST['start_time'];
     }
     if (empty($_REQUEST["end_time"])) {
         $datas['end_time'] = date("Y-m-d H:i:s");
     } else {
         $datas['end_time'] = $_REQUEST['end_time'];
     }
     if (!empty($_REQUEST["account"])) {
         $datas['username'] = $_REQUEST['account'];
     }
     if (!empty($_REQUEST["ip"])) {
         $datas['ip'] = $_REQUEST['ip'];
     }
     if ($_REQUEST['status'] != 'all') {
         $datas['status'] = $_REQUEST['status'];
     }
     $datas['date'] = array('between', "{$datas['start_time']},{$datas['end_time']}");
     $page_data = model("Log")->logList($datas);
     $this->assign("list", $page_data["data"]);
     $this->assign("page", $page_data["page"]);
     $this->display("Log:index");
 }
開發者ID:WALES7CH,項目名稱:TP-Admin,代碼行數:27,代碼來源:LogController.class.php

示例10: unsetNotificationCount

 public function unsetNotificationCount()
 {
     if (empty($this->user_id) && isset($this->mid)) {
         switch ($this->data['type']) {
             // 暫僅允許message/weibo_commnet/atMe
             case 'message':
                 return (int) model('Message')->setAllIsRead($this->mid);
             case 'weibo_comment':
                 return (int) model('UserCount')->setZero($this->mid, 'comment');
             case 'atMe':
                 return (int) model('UserCount')->setZero($this->mid, 'atme');
             default:
                 return 0;
         }
     } else {
         switch ($this->data['type']) {
             // 暫僅允許message/weibo_commnet/atMe
             case 'message':
                 return (int) model('Message')->setAllIsRead($this->user_id);
             case 'weibo_comment':
                 return (int) model('UserCount')->setZero($this->user_id, 'comment');
             case 'atMe':
                 return (int) model('UserCount')->setZero($this->user_id, 'atme');
             default:
                 return 0;
         }
     }
 }
開發者ID:armebayelm,項目名稱:thinksns-vietnam,代碼行數:28,代碼來源:UserApi.class.php

示例11: doRegister

 public function doRegister()
 {
     $email = safe($_POST['email']);
     $uname = safe($_POST['uname']);
     $password = safe($_POST['password']);
     $repassword = safe($_POST['re_password']);
     if ($password != $repassword) {
         redirect(U('/Public/register', $_POST), 3, '兩次的密碼不符');
     }
     $service = model('UserRegister');
     $uid = $service->register($email, $uname, $password, true);
     if (!$uid) {
         redirect(U('/Public/register', $_POST), 3, $service->getLastError());
     } else {
         //redirect(U('/Public/login'), 1, '注冊成功');
         if ($user = model('Passport')->getLocalUser($email, $password)) {
             if ($user['is_active'] == 0) {
                 redirect(U('wap/Public/login'), 3, '帳號尚未激活,請激活後重新登錄');
             }
             $result = model('Passport')->registerLogin($user);
             redirect(U('wap/Index/index'));
         } else {
             redirect(U('wap/Public/login'), 3, '帳號或密碼錯誤,請重新輸入');
         }
     }
 }
開發者ID:lyhiving,項目名稱:icampus,代碼行數:26,代碼來源:PublicAction.class.php

示例12: getZBConfig

 public function getZBConfig()
 {
     //獲取配置簡單加密
     $key = $this->data['key'];
     if (md5($this->key) != $key) {
         return $this->rd('', '認證失敗', 1);
     }
     $chongzhi_info = model('Xdata')->get('admin_Config:charge');
     $info['cash_exchange_ratio_list'] = getExchangeConfig('cash');
     $info['charge_ratio'] = $chongzhi_info['charge_ratio'] ?: '100';
     //1人民幣等於多少積分
     $info['charge_description'] = $chongzhi_info['description'] ?: '充值描述';
     //充值描述
     $field = $this->data['field'];
     //關鍵字  不傳為全部
     if ($field) {
         $field = explode(',', $field);
         foreach ($info as $key => $value) {
             if (!in_array($key, $field)) {
                 unset($info[$key]);
             }
         }
     }
     return $this->rd($info);
 }
開發者ID:medz,項目名稱:thinksns-4,代碼行數:25,代碼來源:ApplicationApi.class.php

示例13: feedback

 /**
  * 添加意見反饋操作
  */
 public function feedback()
 {
     if (t($_POST['textarea'])) {
         $feedbacktype = D('')->table(C('DB_PREFIX') . 'feedback_type')->where('type_name = "' . t($_POST['select']) . '"')->find();
         $map['feedbacktype'] = $feedbacktype['type_id'];
         $map['feedback'] = t($_POST['textarea']);
         $map['uid'] = $this->mid;
         $map['cTime'] = time();
         $map['type'] = 0;
         $res = model('Feedback')->add($map);
         if ($map['feedback'] == '') {
             $this->error(L('PUBLIC_INPUT_FEEDBACK'));
             // 請填寫反饋內容
         }
         if ($res) {
             $touid = D('user_group_link')->where('user_group_id=1')->field('uid')->findAll();
             foreach ($touid as $k => $v) {
                 model('Notify')->sendNotify($v['uid'], 'feedback_audit');
             }
             $return = array('status' => 1, 'data' => L('PUBLIC_REPORTING_INFO'));
             $this->assign('jumpUrl', U('public/Index/index'));
             $this->success(L('PUBLIC_SUBMIT_FEEDBACK_SUCCESS'));
             // 提交成功,感謝您的反饋
         } else {
             $this->error(model()->getError());
         }
     } else {
         $this->error(L('PUBLIC_INPUT_FEEDBACK'));
         // 請填寫反饋內容
     }
 }
開發者ID:medz,項目名稱:thinksns-4,代碼行數:34,代碼來源:FeedbackAction.class.php

示例14: test

 function test()
 {
     $a = model('Test');
     $key = '1234';
     $this->swoole->cache->delete($key);
     $this->db->getAffectedRows();
 }
開發者ID:matyhtf,項目名稱:swoole_framework,代碼行數:7,代碼來源:User.php

示例15: doshorturl

 public function doshorturl()
 {
     $data['shorturl_type'] = $_POST['shorturl_type'];
     $data['customize_url'] = h($_POST['customize_url']);
     model('Xdata')->lput('shorturl', $data);
     $this->redirect('admin/Plugin/shorturl');
 }
開發者ID:armebayelm,項目名稱:thinksns-vietnam,代碼行數:7,代碼來源:PluginAction.class.php


注:本文中的model函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。