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


PHP Controller::model方法代码示例

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


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

示例1: index

 public function index()
 {
     $db = Controller::model('DBconnect', '');
     $res = "Main";
     $module = Controller::module('works/index');
     $news = Controller::module('news/index');
     Controller::view('home/index', array('name' => $res, 'module' => $module, 'news' => $news));
 }
开发者ID:shipovalovyuriy,项目名称:MVC,代码行数:8,代码来源:home.php

示例2: Games

 public function Games($id = -1)
 {
     parent::model('BD');
     if ($id <= 0) {
         $table = BD::LoadAPIGames();
         echo json_encode($table);
     } else {
         $table = BD::LoadAPIGame($id);
         echo json_encode($table);
     }
 }
开发者ID:gragor3000,项目名称:Tp2-Web2,代码行数:11,代码来源:API.php

示例3: relation

 /**
  * 相关文章列表
  */
 protected function relation($id, $num = 10)
 {
     if (empty($id)) {
         return false;
     }
     $db = Controller::model('content');
     $row = $db->from('content_' . App::get_site_id() . '_extend')->where('id=' . (int) $id)->select(false);
     if (empty($row) || empty($row['relation'])) {
         return null;
     }
     $ids = $row['relation'];
     $data = $db->relation($ids, $num);
     return $data;
 }
开发者ID:kennyhonghui,项目名称:zhuoxi,代码行数:17,代码来源:View.php

示例4: set

 /**
  * 添加、修改内容数据
  */
 public function set($id, $tablename, $data)
 {
     $id = intval($id);
     if (!$this->is_table_exists($tablename)) {
         return lang('m-con-37', array('1' => $tablename));
     }
     $table = Controller::model($tablename);
     //加载附表Model
     if (empty($data['catid'])) {
         return lang('m-con-8');
     }
     $_data = $id ? $this->find($id) : null;
     //数组转化为字符
     foreach ($data as $i => $t) {
         if (is_array($t)) {
             $data[$i] = array2string($t);
         }
     }
     //描述截取
     if (empty($data['description']) && isset($data['content'])) {
         $len = isset($data['fn_add_introduce']) && $data['fn_add_introduce'] && $data['fn_introcude_length'] ? $data['fn_introcude_length'] : 200;
         $data['description'] = str_replace(array(PHP_EOL, '  '), array('', ''), strcut(clearhtml($data['content']), $len));
     }
     //下载远程图片
     if (isset($data['content']) && isset($data['fn_down_image']) && $data['fn_down_image']) {
         $content = str_replace(array('\\', '"'), array('', '\''), htmlspecialchars_decode($data['content']));
         if (preg_match_all("/(src)=([\"|']?)([^ \"'>]+\\.(gif|jpg|jpeg|bmp|png))\\2/i", $content, $imgs)) {
             $userid = !$data['sysadd'] && $data['userid'] ? $data['userid'] : (!$_data['sysadd'] && $_data['userid'] ? $_data['userid'] : 0);
             $sysadd = $data['sysadd'] ? $data['sysadd'] : ($_data['sysadd'] ? $_data['sysadd'] : 0);
             if ($userid) {
                 //表示会员投稿
                 $member = $this->execute("select groupid from {$this->prefix}member where id=" . $userid, false);
                 $group = $this->execute("select * from {$this->prefix}member_group where id=" . (int) $member['groupid'], false);
                 $result = $this->download_images($imgs[3], $userid, (int) $group['filesize']);
             } elseif ($sysadd) {
                 //表示管理员投稿
                 $result = $this->download_images($imgs[3]);
             }
             if (isset($result) && $result) {
                 $image = $result['replace'][0];
                 $data['content'] = str_replace($result['regex'], $result['replace'], $data['content']);
             }
         }
     }
     //提取缩略图
     if (empty($data['thumb']) && isset($data['content']) && isset($data['fn_auto_thumb']) && $data['fn_auto_thumb']) {
         if (isset($image)) {
             $data['thumb'] = $image;
         } else {
             $content = str_replace(array('\\', '"'), array('', '\''), htmlspecialchars_decode($data['content']));
             if (preg_match("/(src)=([\"|']?)([^ \"'>]+\\.(gif|jpg|jpeg|bmp|png))\\2/i", $content, $img)) {
                 $data['thumb'] = $img[3];
             }
         }
     }
     //关键字处理
     if ($data['keywords']) {
         $data['keywords'] = str_replace(',', ',', $data['keywords']);
         $tags = @explode(',', $data['keywords']);
         if ($tags) {
             foreach ($tags as $t) {
                 $name = trim($t);
                 if ($name) {
                     $d = $this->from('tag', 'id')->where('name=?', $name)->select(false);
                     if (empty($d)) {
                         $this->query('INSERT INTO `' . $this->prefix . 'tag` (`name`,`letter`) VALUES ("' . $name . '", "' . word2pinyin($name) . '")');
                     }
                 }
             }
         }
     }
     $status = 1;
     //用于判断积分增加
     $is_add = 0;
     if ($id) {
         //修改
         if (empty($_data)) {
             $data['id'] = $id;
             $data['url'] = getUrl($data);
             //更新URL
             $data['status'] = 1;
             //插入时状态设置为1
             $this->insert($data);
             $table->insert($data);
             $is_add = 1;
         } else {
             $data['id'] = $data['id'] ? $data['id'] : $id;
             $data['url'] = getUrl($data);
             //更新URL
             unset($data['id']);
             $data['status'] = $data['status'] > 0 ? 1 : 0;
             //修改时,非0状态设置为1
             $this->update($data, 'id=' . $id);
             $table->update($data, 'id=' . $id);
             $status = 0;
             //修改时不作为积分处理
             $data['userid'] = $_data['userid'];
//.........这里部分代码省略.........
开发者ID:kennyhonghui,项目名称:zhuoxi,代码行数:101,代码来源:ContentModel.php

示例5: relation

 /**
  * 相关文章列表
  */
 protected function relation($id, $num = 10, $more = 0)
 {
     if (empty($id)) {
         return false;
     }
     $db = Controller::model('content');
     $row = $db->from('content_' . App::get_site_id() . '_extend')->where('id=' . (int) $id)->select(false);
     if (empty($row) || empty($row['relation'])) {
         return null;
     }
     $ids = $row['relation'];
     $num = $num ? $num : 10;
     if ($more) {
         $cats = get_category_data(App::get_site_id());
         $models = get_model_data('content', App::get_site_id());
         $table = $models[$cats[$row['catid']]['modelid']]['tablename'];
         if ($table) {
             $sql = 'select * from `' . $this->ci->db->dbprefix('content_' . App::get_site_id()) . '` as a left join `' . $this->ci->db->dbprefix($table) . '` as b on a.id=b.id where a.id IN (' . $ids . ') order by a.listorder desc, a.updatetime desc limit ' . $num;
             $data = $this->ci->db->query($sql)->result_array();
             return $data;
         }
     }
     $data = $db->from('content_' . App::get_site_id())->where('id in (' . $ids . ')')->order('listorder desc, updatetime desc')->limit($num)->select();
     return $data;
 }
开发者ID:rainbow88,项目名称:hummel,代码行数:28,代码来源:View.php

示例6: log

 public function log()
 {
     parent::model("docs");
     $_model = new docs();
     //Contient toutes les données à afficher
     $data = array();
     if (isset($_POST["logText"])) {
         if ($_POST["logText"] != "") {
             $_model->SaveLog($_SESSION['ID'], $_POST["logText"]);
         }
     }
     $data['logs'] = $_model->LoadLog($_SESSION['ID']);
     $data['logs'] = array_reverse($data['logs']);
     parent::view("shared/header");
     parent::view("intern/menu");
     parent::view('intern/log', $data);
     parent::view('shared/footer');
 }
开发者ID:gragor3000,项目名称:Projet-Integrateur,代码行数:18,代码来源:intern.php

示例7: model

 /**
  * 单例模式实例化一个Model对象
  */
 public function model($table_name)
 {
     return Controller::model($table_name);
 }
开发者ID:kennyhonghui,项目名称:zhuoxi,代码行数:7,代码来源:Common.php

示例8: __construct

 public function __construct()
 {
     parent::model("models");
     parent::model("installer");
     $this->installer = new installer();
 }
开发者ID:gragor3000,项目名称:Projet-Integrateur,代码行数:6,代码来源:install.php

示例9: submitCie

 public function submitCie()
 {
     parent::model("business");
     parent::model("accounts");
     $business = new business();
     $user = new accounts();
     if (!$business->EmailExist($_POST["email"])) {
         if ($user->UsernameExist($_POST["user"]) || $_POST["user"] == "") {
             $_POST["user"] = $user->PassGen();
         }
         try {
             $user->CreateUser($_POST["name"], $_POST["user"], $user->PassGen(), 1);
             $business->CreateBusiness($_POST["address"], $_POST["city"], $_POST["tel"], $_POST["email"], $user->DBLastInsertedID('users'));
             $data['alert'] = "alert-success";
             $data['message'] = "L'entreprise a été soumise aux coordonnateurs de stage. Merci de votre participation.";
         } catch (PDOException $e) {
             $data['alert'] = "alert-warning";
             $data['message'] = "L'entreprise n'a pu être soumise aux coordonnateurs de stage. Veuillez réessayer.";
         }
     } else {
         $data['alert'] = "alert-warning";
         $data['message'] = "Une entreprise avec ce même email existe déjà.";
     }
     parent::view('shared/header');
     parent::view('home/menu');
     parent::view('home/index', $data);
     parent::view('shared/footer');
 }
开发者ID:gragor3000,项目名称:Projet-Integrateur,代码行数:28,代码来源:home.php

示例10: model

 public static function model($className = __CLASS__)
 {
     return parent::model($className);
 }
开发者ID:liudaiming,项目名称:Datastructure,代码行数:4,代码来源:CountryController.php

示例11: action_form_postulacion

 public function action_form_postulacion()
 {
     if (isset($_GET['postulacion']) && $_GET['postulacion'] == 'nueva' && isset($_POST['postulacion']) && $_POST['postulacion']) {
         $data = $_POST['postulacion'];
         $data['ext_curriculum'] = 'none';
         parent::model('Model_Postulacion')->set_data($data);
         $valid_data = parent::model('Model_Postulacion')->validate();
         if (isset($_FILES) && $_FILES['curriculum']) {
             $fileCurriculum = $_FILES['curriculum'];
             $fileName = explode('.', $fileCurriculum['name']);
             $secciones = count($fileName);
             $upload = Upload::factory('private_files');
             $upload->file($fileCurriculum);
             $upload->set_max_file_size(3);
             $upload->set_allowed_mime_types(array('application/pdf', 'application/vnd.openxmlformats-officedocument.wordprocessingml.document', 'application/msword'));
             if ($upload->check() && parent::model('Model_Postulacion')->valid) {
                 if ($secciones > 1) {
                     $extencion = $fileName[$secciones - 1];
                     parent::model('Model_Postulacion')->ext_curriculum = $extencion;
                     if ($id_postulacion = parent::model('Model_Postulacion')->save()) {
                         $upload->set_filename($id_postulacion . '.' . parent::model('Model_Postulacion')->ext_curriculum);
                         $upload->save();
                         parent::set_mensaje('Gracias, tu postulacion ha sido aceptada y guardada con éxito');
                         // envío correo administrador de nueva postulación
                         $email_admin = get_option('admin_email');
                         parent::model('Correos', array('to' => $email_admin, 'subject' => 'Nueva Postulacion'));
                         // exit();
                         parent::model('Correos')->send('Nueva Postulacion para la oferta "' . get_the_title(parent::model('Model_Postulacion')->id_oferta) . '"');
                         header('Location: ' . get_permalink(parent::model('Model_Postulacion')->id_oferta));
                         exit;
                     } else {
                         parent::set_error('Ha ocurrido un error al guardar los datos, por favor intentalo mas tarde');
                         parent::model('Model_Postulacion')->set_session_data();
                         header('Location: ' . get_permalink(parent::model('Model_Postulacion')->id_oferta));
                         exit;
                     }
                 } else {
                     parent::set_error('Archivo no válido');
                     parent::model('Model_Postulacion')->set_session_data();
                     header('Location: ' . get_permalink(parent::model('Model_Postulacion')->id_oferta));
                     exit;
                 }
             } else {
                 parent::model('Model_Postulacion')->set_session_data();
                 if (!parent::model('Model_Postulacion')->valid) {
                     parent::set_error($valid_data);
                 }
                 parent::set_error($upload->get_errors());
                 header('Location: ' . get_permalink(parent::model('Model_Postulacion')->id_oferta));
                 exit;
             }
         }
     } else {
         // // parent::model('Model_Postulacion')->set_session_data();
         // header('Location: /');
         // exit();
     }
 }
开发者ID:pqzada,项目名称:wp-test,代码行数:58,代码来源:Postulacion.php

示例12: evalAdv

 public function evalAdv($_review)
 {
     parent::model("accounts");
     parent::model("docs");
     $model1 = new accounts();
     $model2 = new docs();
     if (isset($_review["intern"]) && isset($_review["#review"]) || isset($_POST["intern"])) {
         $data['advisors'] = $model1->ShowUsersByRank(0);
         $data['interns'] = $model1->ShowUsersByRank(2);
         $intern = null;
         $review = null;
         if (isset($_POST['intern'])) {
             $_review = null;
             $intern = $_POST['intern'];
             $review = $_POST['review'];
         } else {
             if ($_review != null) {
                 $intern = $_review["intern"];
                 $review = $_review["#review"];
             }
         }
         $data['readOnly'] = $model2->ReadOnlyAdvisor($intern, $review);
         parent::model("projects");
         $project = new projects();
         $projectIntern = null;
         if (ctype_digit($intern)) {
             $projectIntern = $project->ShowProjectByIntern($intern);
         }
         if ($projectIntern != null) {
             if (!$data['readOnly']) {
                 if (isset($_POST['evalIntern']) && $_SESSION['form_timer'] + 300 > time()) {
                     try {
                         $model2->SaveAdvisor($_SESSION['ID'], $review, $_POST);
                         $data['alert'] = "alert-success";
                         $data['message'] = "L'évaluation a été enregistrée avec succès!";
                         $data['review'] = $model2->LoadAdvisor($intern, $review);
                         $data['readOnly'] = true;
                     } catch (exception $ex) {
                         $data['alert'] = "alert-warning";
                         $data['message'] = "L'enregistrement de l'évaluation a échoué.";
                         $this->ShowInterns($data);
                     }
                 }
             } else {
                 $data['alert'] = "alert-warning";
                 $data['message'] = "Cette évaluation existe déjà pour ce stagiaire.";
                 $data['review'] = $model2->LoadAdvisor($intern, $review);
             }
             $data['intern'] = $intern;
             $data['#review'] = $review;
             parent::view("shared/header");
             parent::view("advisor/menu");
             parent::view("advisor/eval", $data);
             parent::view("shared/footer");
         } else {
             $data['alert'] = "alert-warning";
             $data['message'] = "Ce stagiaire n'a pas encore été jumelé à un projet.";
             $this->ShowInterns($data);
         }
     } else {
         $this->ShowInterns(null);
     }
 }
开发者ID:gragor3000,项目名称:Projet-Integrateur,代码行数:63,代码来源:advisor.php

示例13: model

 /**
  * Create and return the instance of the model specified by the parameter
  * 
  * @param string $className Class name of model
  * @param string $alias Alias in SQL
  * @param PDO $db PDO instance
  * @return Model
  */
 public function model($className, $alias = null, $db = null)
 {
     return $this->_controllerInstance->model($className, $alias, $db);
 }
开发者ID:2626suke,项目名称:curryfw,代码行数:12,代码来源:plugin_abstract.php

示例14: get_content_value

function get_content_value($content)
{
    if ($content != '' && preg_match('/^\\{M:(.+)\\}$/U', $content, $field)) {
        if (App::get_namespace_id() == 'admin') {
            return null;
        }
        if (!get_cookie('member_id')) {
            return null;
        }
        $member = Controller::model('member');
        $name = trim($field[1]);
        $data = $member->find(get_cookie('member_id'));
        if (isset($data[$name])) {
            return $data[$name];
        }
        $cache = new cache_file();
        $model = $cache->get('model_member');
        $_member = Controller::model($model[$data['modelid']]['tablename']);
        $_data = $_member->find(get_cookie('member_id'));
        if (isset($_data[$name])) {
            return $_data[$name];
        }
    } else {
        return $content;
    }
}
开发者ID:kennyhonghui,项目名称:zhuoxi,代码行数:26,代码来源:fields.php

示例15: get_member_info

/**
 * 会员信息调用
 * @param  $uid
 * @param  $more
 * @return array
 */
function get_member_info($uid, $more = 0)
{
    if (empty($uid)) {
        return null;
    }
    $member = Controller::model('member');
    $data = $member->find($uid);
    if (empty($data)) {
        return null;
    }
    if ($more) {
        //会员附表
        $cache = new cache_file();
        $model = $cache->get('model_member');
        if (isset($model[$data['modelid']])) {
            $d = Controller::model($model[$data['modelid']]['tablename']);
            $r = $d->find($uid);
            $data = array_merge($r, $data);
        }
    }
    unset($data['password']);
    return $data;
}
开发者ID:kennyhonghui,项目名称:zhuoxi,代码行数:29,代码来源:function.php


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