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


PHP Model::Factory方法代码示例

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


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

示例1: cats_search

 public function cats_search()
 {
     function vals($str)
     {
     }
     $qu = explode("&", $this->get->search_query);
     //            echo '<pre>';
     $q = preg_replace("/[^a-zA-Z0-9\\=]+/", "", $qu);
     $query = '';
     foreach ($q as $key => $val) {
         $v = explode("=", $val);
         if ($v[1] > 0) {
             if ($key < count($q) && $key > 0) {
                 $query .= ' AND ';
             }
             $query .= ' ' . $v[0] . " LIKE '%" . $v[1] . "%' ";
         }
         if ($v[0] == 'gender' && $v[1] != '') {
             $query .= ' AND ' . $v[0] . " LIKE '%" . $v[1] . "%' ";
         }
     }
     //            var_dump($query);
     //            echo '</pre>';
     //----------- Gatos
     $m = Model::Factory('cats');
     $m->where($query . ' AND id > 6000');
     $this->views->data->cats = $m->all();
     $this->views->display('novo/search_cats_results.phtml');
 }
开发者ID:alegalliard,项目名称:aug,代码行数:29,代码来源:SearchController2.php

示例2: cats_search

 public function cats_search()
 {
     $qu = explode("&", $this->get->search_query);
     //            echo '<pre>';
     $q = preg_replace("/[^a-zA-Z0-9\\=]+/", "", $qu);
     $query = '';
     $query2 = '';
     foreach ($q as $key => $val) {
         $v = explode("=", $val);
         switch ($v[0]) {
             case 'gender':
                 if (strlen($v[1]) == 1) {
                     $query2 .= $v[0] . " LIKE '%" . $v[1] . "%' AND ";
                 } else {
                     if (strlen($v[1]) == 2) {
                         $p1 = substr($v[1], 0, 1);
                         $p2 = substr($v[1], 1, 2);
                         $query2 .= " (" . $v[0] . " LIKE '%" . $p1 . "%' OR " . $v[0] . " LIKE '%" . $p2 . "%') AND ";
                     }
                 }
                 break;
             default:
                 if ($v[1] != "0") {
                     $query2 .= $v[0] . " LIKE '%" . $v[1] . "%' AND ";
                 }
         }
     }
     $query = $query2 . " (status LIKE '0' AND section LIKE '1' AND inactive LIKE '0')";
     //----------- Gatos
     $m = Model::Factory('cats');
     $m->where($query . ' AND id > 3000');
     $this->views->data->cats = $m->all();
     $this->views->display('search_cats_results.phtml');
 }
开发者ID:alegalliard,项目名称:aug,代码行数:34,代码来源:SearchController.php

示例3: delete

 public function delete()
 {
     $m = Model::Factory('billboard');
     $m->where("id={$this->get->id}");
     $m->delete();
     Request::redirect(HOST . 'adm/destaques/');
 }
开发者ID:alegalliard,项目名称:aug,代码行数:7,代码来源:BillBoardController.php

示例4: delete

 public function delete()
 {
     $m = Model::Factory('newsletter');
     $m->where("id='{$this->get->id}'");
     $m->delete();
     Request::redirect(HOST . 'adm/newsletter');
 }
开发者ID:alegalliard,项目名称:aug,代码行数:7,代码来源:NewsletterController.php

示例5: delete

 public function delete()
 {
     $m = Model::Factory('pressreleases');
     $m->where('id=' . $this->get->id);
     $m->delete();
     Request::redirect(HOST . 'adm/aug-na-midia/');
 }
开发者ID:alegalliard,项目名称:aug,代码行数:7,代码来源:PressReleasesController.php

示例6: save

 public function save()
 {
     if (isset($this->files->cat_picture['name']) and $this->files->cat_picture['name'] != '') {
         $dirname = UPLOAD_DIR . 'cats' . SEPD;
         $filename = date('YmdHis') . md5($this->files->cat_picture['name']) . '.' . end(explode('.', $this->files->cat_picture['name']));
         if (!is_dir($dirname)) {
             mkdir($dirname, 0777, true);
         }
         move_uploaded_file($this->files->cat_picture['tmp_name'], $dirname . $filename);
     }
     $mdl = Model::Factory('cats');
     $mdl->name = $this->post->cat_name;
     $mdl->description = $this->post->cat_desc;
     $mdl->full_description = $this->post->cat_full_desc;
     $mdl->social = $this->post->social;
     $mdl->playful = $this->post->playful;
     $mdl->lovely = $this->post->lovely;
     $mdl->special = 1;
     if (isset($filename)) {
         $mdl->picture = $filename;
     }
     if (isset($this->post->id)) {
         $mdl->where("id='{$this->post->id}'");
         $mdl->update();
     } else {
         $mdl->insert();
     }
     Request::redirect(HOST . 'adm/gatos-especiais/');
 }
开发者ID:alegalliard,项目名称:aug,代码行数:29,代码来源:SpecialCatsController.php

示例7: SignUpProccess

 public function SignUpProccess()
 {
     $o = new stdClass();
     $o->username = !(bool) Model::Factory('user', false, false)->where("login='{$this->post->login}'")->get();
     $o->email = !(bool) Model::Factory('user', false, false)->where("email='{$this->post->email}'")->get();
     $o->status = $o->username && $o->email;
     if ($o->status) {
         $m = Model::Factory('user');
         $m->login = $this->post->login;
         $m->email = $this->post->email;
         $m->password = md5($this->post->password);
         $m->name = $this->post->real_name;
         $m->active = 1;
         $m->created_at = date('Y-m-d H:i:s');
         $user_id = $m->insert();
         $m = Model::Factory('user_data');
         $m->genre = 'M';
         $m->avatar = 'default.jpg';
         $m->user_id = $user_id;
         $m->insert();
         $m = Model::Factory('user_points');
         $m->exp = 0;
         $m->hp = 10;
         $m->gold = 0;
         $m->current_level = 1;
         $m->exp_needed = 0;
         $m->exp_to_next_level = 600;
         $m->insert();
     }
     header("Content-type:text/html;charset=utf-8");
     die(json_encode($o));
 }
开发者ID:Anpix,项目名称:rede-social,代码行数:32,代码来源:SignupController.php

示例8: get_total_pages

 public static function get_total_pages()
 {
     $m = Model::Factory('newsletter');
     $m->fields('COUNT(*) AS qtd');
     $data = $m->get();
     return ceil($data->qtd / 25);
 }
开发者ID:alegalliard,项目名称:aug,代码行数:7,代码来源:Newsletter.php

示例9: remove

 public static function remove($uid, $list_id)
 {
     Model::Factory('user_lists_has_social_network')->where("user_lists_id='{$list_id}'")->delete();
     Model::Factory('user_lists_has_category')->where("user_lists_id='{$list_id}'")->delete();
     Model::Factory('user_lists')->where("user_id='{$uid}' AND id='{$list_id}'")->delete();
     PhxMemcache::delete('lists_' . $this->session->user->id);
 }
开发者ID:Anpix,项目名称:rede-social,代码行数:7,代码来源:Lists.php

示例10: delete

 public function delete()
 {
     $m = Model::Factory('pages');
     $m->inactive = 1;
     $m->where("id=" . $this->get->page_id);
     $m->update();
     Request::redirect(HOST . 'adm/paginas/');
 }
开发者ID:alegalliard,项目名称:aug,代码行数:8,代码来源:PagesController.php

示例11: grant

 public static function grant($uid, $bid)
 {
     $m = Model::Factory('user_has_badge uhb');
     $m->user_id = $uid;
     $m->badge_id = $bid;
     $m->date = date('Y-m-d H:i:s');
     return $m->insert();
 }
开发者ID:Anpix,项目名称:rede-social,代码行数:8,代码来源:Badges.php

示例12: DeleteMessage

 public function DeleteMessage()
 {
     $m = Model::Factory('messages');
     $m->status = 'D';
     $m->where("id='{$this->get->msgid}' AND to_user_id='{$this->session->user->id}'");
     $status = $m->update();
     Request::redirect(HOST);
 }
开发者ID:Anpix,项目名称:rede-social,代码行数:8,代码来源:MessagesController.php

示例13: get

 public static function get($pid)
 {
     $m = Model::Factory('posts p', false);
     $m->fields('p.id', 'p.date', 'p.like_count', 'p.dislike_count', 'p.comment_count', 'p.reblog_count', 'p.title', 'p.content', 'u.login');
     $m->innerJoin('user u', 'u.id = p.user_id');
     $m->where("p.id='{$pid}' AND promoted IS NULL");
     return $m->get();
 }
开发者ID:Anpix,项目名称:rede-social,代码行数:8,代码来源:Posts.php

示例14: get_names

 public static function get_names(array $ids)
 {
     $m = Model::Factory('godfather');
     $m->fields('id', 'nome');
     $m->where("id IN (" . implode(', ', $ids) . ")");
     $m->order("nome ASC");
     return $m->all();
 }
开发者ID:alegalliard,项目名称:aug,代码行数:8,代码来源:Godfather.php

示例15: change_permission

 public function change_permission()
 {
     $m = Model::Factory('users');
     $m->level = 1;
     $m->where("id=" . $this->get->uid);
     $m->update();
     Request::redirect(HOST . 'adm/usuarios/');
 }
开发者ID:alegalliard,项目名称:aug,代码行数:8,代码来源:UsersController.php


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