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


PHP DAO::getDAO方法代码示例

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


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

示例1: view

 public function view()
 {
     $dao = DAO::getDAO('UserDAO');
     if (isset($this->params[0]) && trim($this->params[0]) == 'remove') {
         // ex: requesting: /user-list/delete/2
         $id = trim(sanitizeString($this->params[1]));
         $dao->removeById($id);
     } else {
         if (isset($this->params[0]) && trim($this->params[0]) == 'add') {
             $randNum = mt_rand(0, 99999);
             $newUser = new User(array('firstName' => 'First', 'lastName' => 'LastName', 'username' => "test{$randNum}", 'email' => "test{$randNum}@example.com", 'createTime' => dbDateTime()));
             // #TODO: implement UserDao.create($newUser) instead.
             if ($dao->countAll() > 30) {
                 // Demo mode: clean up if too many users
                 $dao->execute("DELETE FROM user");
                 $dao->execute("vacuum");
             }
             $dao->insertInto("firstName, lastName, username, email, createTime", $newUser->getFields());
         }
     }
     $users = $dao->getAll();
     $v = $this->smarty;
     $v->assign('title', 'User List');
     $v->assign('inc_content', v('user_list.html'));
     $v->assign('users', $users);
     $v->assign('totalUsers', $dao->countAll());
     $this->display($v, v('index.html'));
 }
开发者ID:rsanaie,项目名称:Thin-PHP-Framework,代码行数:28,代码来源:UserList.php

示例2: view

 public function view()
 {
     $dao = DAO::getDAO('SearchDAO');
     if (isset($this->params[0]) && trim($this->params[0]) == 'remove') {
         // ex: requesting: /search/delete/2
         $id = trim(sanitizeString($this->params[1]));
         $dao->removeById($id);
     } else {
         if (isset($this->params[0]) && trim($this->params[0]) == 'add') {
             $randNum = mt_rand(0, 99999);
             $newSearch = new Search(array('username' => "test{$randNum}", 'email' => "test{$randNum}@example.com", 'created' => dbDateTime()));
             // #TODO: implement UserDao.create($newUser) instead.
             if ($dao->countAll() > 30) {
                 // Demo mode: clean up if too many searchs
                 $dao->execute("DELETE FROM searchs");
                 $dao->execute("vacuum");
             }
             $dao->insertInto("username, email, created", $newSearch->getFields());
         }
     }
     $search = $dao->getAll();
     $v = $this->smarty;
     $v->assign('title', 'Search List');
     $v->assign('inc_content', v('search.html'));
     $v->assign('search', $search);
     $v->assign('totalSearch', $dao->countAll());
     $this->display($v, v('index.html'));
 }
开发者ID:renduples,项目名称:alibtob,代码行数:28,代码来源:Search.php

示例3: view

 public function view()
 {
     if ($this->isPosting()) {
         return $this->processPost();
     }
     $dao = DAO::getDAO('PostDAO');
     $v = $this->smarty;
     $v->assign('title', t('home_page_title'));
     $this->processAction($dao, $v);
     $this->display($v, v('index.html'));
 }
开发者ID:renduples,项目名称:alibtob,代码行数:11,代码来源:Blog.php

示例4: view

 public function view()
 {
     $postId = $this->params[0];
     $dao = DAO::getDAO('PostDAO');
     $post = $dao->getById($postId);
     $postContent = html_entity_decode($post['content']);
     $postComments = BaseController::callController(BASEEXT . '/blog', 'BlogComment', array($postId));
     $v = $this->smarty;
     $v->setTemplateDir(BASEEXT . '/blog/view');
     $v->assign('post', $post);
     $v->assign('postContent', $postContent);
     $v->assign('postComments', $postComments);
     $this->display($v, 'blog_show.html');
 }
开发者ID:renduples,项目名称:alibtob,代码行数:14,代码来源:BlogShow.php

示例5: view

 public function view()
 {
     $dao = DAO::getDAO('PostDAO');
     $posts = $dao->getAll();
     for ($i = 0, $cnt = count($posts); $i < $cnt; $i++) {
         $content = html_entity_decode($posts[$i]['content']);
         $content = str_replace("\n", '<br/>', $content);
         $posts[$i]['content'] = $content;
         $posts[$i]['seoTitle'] = seoTitle($posts[$i]['title']);
     }
     $v = $this->smarty;
     $v->setTemplateDir(BASEEXT . '/blog/view');
     $v->assign('posts', $posts);
     $this->display($v, 'blog_list.html');
 }
开发者ID:renduples,项目名称:alibtob,代码行数:15,代码来源:BlogList.php

示例6: processPost

 public function processPost()
 {
     parent::processPost();
     // #TODO: User submitted data. Save it to DB, email, etc.
     copyArray($_POST, $v, '*');
     $dao = DAO::getDAO('UserDAO');
     $newUser = new User(array('firstName' => 'First', 'lastName' => 'LastName', 'username' => $v['username'], 'email' => $v['email'], 'password' => $v['password'], 'createTime' => dbDateTime()));
     $ret = $dao->insertInto('firstName, lastName, username, email, password, createTime', $newUser->getFields());
     if ($ret[0] != '00000') {
         $err = "<span class='msgErr'>ERROR: {$ret['2']}</span>";
     }
     $v = $this->smarty;
     $v->assign('title', 'Thank you!');
     $v->assign('content', '<h2>Thank you!</h2><p>Thanks for your registration.</p><p>' . $err . '<p/><p><a href="/user-list">Check User List</a><p/>');
     $v->assign('inc_content', 'blank.html');
     $this->display($v, v('index.html'));
 }
开发者ID:renduples,项目名称:alibtob,代码行数:17,代码来源:Register.php

示例7: view

 public function view()
 {
     if ($this->isPosting()) {
         return $this->processPost();
     }
     $postId = $this->params[0];
     $dao = DAO::getDAO('PostDAO');
     $post = $dao->getById($postId);
     $postContent = $post['content'];
     $postContent = html_entity_decode($postContent);
     $postContent = Wiki2html::process($postContent);
     $v = $this->smarty;
     $v->setTemplateDir(BASEEXT . '/blog/view');
     $v->assign('post', $post);
     $v->assign('postContent', $postContent);
     $this->display($v, 'blog_edit.html');
 }
开发者ID:renduples,项目名称:alibtob,代码行数:17,代码来源:BlogEdit.php

示例8: view

 public function view()
 {
     if ($this->isValidating()) {
         return $this->validate(RT_JSON);
     }
     if ($this->isPosting()) {
         return $this->processPost();
     }
     $itemId = $this->params[0];
     $dao = DAO::getDAO('CommentDAO');
     $comments = $dao->getComments(1, $itemId);
     // prepare Comments for the View
     for ($i = 0, $cnt = count($comments); $i < $cnt; $i++) {
         $cmt = $comments[$i];
         $stEmail = trim($cmt['authorEmail']);
         if ($stEmail != '') {
             $comments[$i]['gravatarImg'] = '<img src="http://www.gravatar.com/avatar/' . md5($stEmail) . '?d=mm&s=64">';
         }
         $content = html_entity_decode($cmt['content']);
         $content = str_replace("\n", '<br/>', $content);
         $comments[$i]['content'] = $content;
         $sWeight = $cmt['weight'] . '';
         // calculate indent (for left-margin) from weight
         if (strpos($sWeight, '.') === false) {
             $comments[$i]['indent'] = 0;
         } else {
             $sWeight = substr($sWeight, strpos($sWeight, '.') + 1);
             $comments[$i]['indent'] = strlen($sWeight) / 2;
         }
     }
     $v = $this->smarty;
     $v->setTemplateDir(BASEEXT . '/blog/view');
     $v->assign('commentTotal', count($comments));
     $v->assign('comments', $comments);
     $v->assign('itemId', $itemId);
     $this->display($v, 'blog_comment.html');
 }
开发者ID:renduples,项目名称:alibtob,代码行数:37,代码来源:BlogComment.php

示例9: init

 public static function init()
 {
     self::$cache = new CMemCache();
     // set your favourite cache here
     self::$dao = DAO::getDAO('UserDAO');
 }
开发者ID:renduples,项目名称:alibtob,代码行数:6,代码来源:UserCache.php


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