• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP jDao类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: getRight

 /**
  * return the value of the right on the given subject (and on the optional resource)
  * @param string $subject the key of the subject
  * @param string $resource the id of a resource
  * @return array list of values corresponding to the right
  */
 public function getRight($subject, $resource = null)
 {
     if ($resource === null && isset(self::$acl[$subject])) {
         return self::$acl[$subject];
     } elseif (isset(self::$aclres[$subject][$resource])) {
         return self::$aclres[$subject][$resource];
     }
     if (!jAuth::isConnected()) {
         // not authificated = no rights
         return array();
     }
     $groups = jAclDbUserGroup::getGroups();
     if (count($groups) == 0) {
         self::$acl[$subject] = array();
         self::$aclres[$subject][$resource] = array();
         return array();
     }
     // get all the values corresponding to the groups which the user has access to,
     //  with the subject and resource indicated
     $values = array();
     $dao = jDao::get('jacldb~jaclrights', 'jacl_profile');
     $list = $dao->getAllGroupRights($subject, $groups);
     foreach ($list as $right) {
         $values[] = $right->value;
     }
     self::$acl[$subject] = $values;
     if ($resource !== null) {
         $list = $dao->getAllGroupRightsWithRes($subject, $groups, $resource);
         foreach ($list as $right) {
             $values[] = $right->value;
         }
         self::$aclres[$subject][$resource] = $values = array_unique($values);
     }
     return $values;
 }
开发者ID:CREASIG,项目名称:lizmap-web-client,代码行数:41,代码来源:db.acl.php


示例2: index

 /**
  * handle the search of specific member
  */
 function index()
 {
     $title = stripslashes(jApp::config()->havefnubb['title']);
     $rep = $this->getResponse('html');
     $letter = $this->param('letter');
     $id_rank = (int) $this->param('id_rank');
     $memberSearch = (string) $this->param('member_search');
     $page = 0;
     $page = (int) $this->param('page');
     // get the group name of the group id we request
     $grpid = $this->param('grpid');
     $groupname = jLocale::get('havefnubb~member.memberlist.allgroups');
     if ($grpid != '__anonymous') {
         $dao = jDao::get('jacl2db~jacl2group');
         $grpname = $dao->get($grpid);
         $groupname = $grpname->name;
     }
     $beginningBy = '';
     if (strlen($letter) == 1) {
         $beginningBy = ' - ' . jLocale::get('havefnubb~member.memberlist.members.beginning.by', array($letter));
     }
     // change the label of the breadcrumb
     if ($page == 0) {
         jApp::coord()->getPlugin('history')->change('label', jLocale::get('havefnubb~member.memberlist.members.list'));
         $rep->title = jLocale::get('havefnubb~member.memberlist.members.list') . ' - ' . $groupname . $beginningBy;
     } else {
         jApp::coord()->getPlugin('history')->change('label', jLocale::get('havefnubb~member.memberlist.members.list') . ' ' . ($page + 1));
         $rep->title = jLocale::get('havefnubb~member.memberlist.members.list') . ' - ' . $groupname . $beginningBy . ' ' . ($page + 1);
     }
     $rep->body->assignZone('MAIN', 'memberlist', array('page' => $page, 'grpid' => $grpid, 'letter' => $letter, 'memberSearch' => $memberSearch));
     return $rep;
 }
开发者ID:havefnubb,项目名称:havefnubb,代码行数:35,代码来源:members.classic.php


示例3: getRight

 /**
  * return the value of the right on the given subject (and on the optional resource)
  * @param string $subject the key of the subject
  * @param string $resource the id of a resource
  * @return array list of values corresponding to the right
  */
 public function getRight($subject, $resource = null)
 {
     if ($resource === null && isset(self::$acl[$subject])) {
         return self::$acl[$subject];
     } elseif (isset(self::$aclres[$subject][$resource])) {
         return self::$aclres[$subject][$resource];
     }
     if (!jAuth::isConnected()) {
         // not authificated = no rights
         return array();
     }
     $groups = jAclDbUserGroup::getGroups();
     if (count($groups) == 0) {
         self::$acl[$subject] = array();
         self::$aclres[$subject][$resource] = array();
         return array();
     }
     // recupère toutes les valeurs correspondant aux groupes auquel appartient le user,
     //   avec le sujet et ressource indiqué
     $values = array();
     $dao = jDao::get('jelix~jaclrights', jAclDb::getProfile());
     $list = $dao->getAllGroupRights($subject, $groups);
     foreach ($list as $right) {
         $values[] = $right->value;
     }
     self::$acl[$subject] = $values;
     if ($resource !== null) {
         $list = $dao->getAllGroupRightsWithRes($subject, $groups, $resource);
         foreach ($list as $right) {
             $values[] = $right->value;
         }
         self::$aclres[$subject][$resource] = $values = array_unique($values);
     }
     return $values;
 }
开发者ID:alienpham,项目名称:helenekling,代码行数:41,代码来源:db.acl.php


示例4: index

 /**
  *
  */
 function index()
 {
     $rep = $this->getResponse('html');
     $tpl = new jTpl();
     $gid = array(0);
     $o = new StdClass();
     $o->id_aclgrp = '0';
     $o->name = jLocale::get('jacl2_admin~acl2.anonymous.group.name');
     $o->grouptype = 0;
     $groups = array($o);
     $grouprights = array(0 => false);
     foreach (jAcl2DbUserGroup::getGroupList() as $grp) {
         $gid[] = $grp->id_aclgrp;
         $groups[] = $grp;
         $grouprights[$grp->id_aclgrp] = false;
     }
     $rights = array();
     $p = jAcl2Db::getProfil();
     $rs = jDao::get('jelix~jacl2subject', $p)->findAllSubject();
     foreach ($rs as $rec) {
         $rights[$rec->id_aclsbj] = $grouprights;
     }
     $rs = jDao::get('jelix~jacl2rights', $p)->getRightsByGroups($gid);
     foreach ($rs as $rec) {
         $rights[$rec->id_aclsbj][$rec->id_aclgrp] = true;
     }
     $tpl->assign(compact('groups', 'rights'));
     if (jAcl2::check('acl.group.modify')) {
         $rep->body->assign('MAIN', $tpl->fetch('groups_right'));
     } else {
         $rep->body->assign('MAIN', $tpl->fetch('groups_right_view'));
     }
     return $rep;
 }
开发者ID:alienpham,项目名称:helenekling,代码行数:37,代码来源:groups.classic.php


示例5: getCat

 /**
  * get the category from the given id
  * @param integer $id current category
  * @return $cat array
  */
 public static function getCat($id)
 {
     if (!isset(self::$cat[$id])) {
         self::$cat[$id] = jDao::get('havefnubb~forum_cat')->get($id);
     }
     return self::$cat[$id];
 }
开发者ID:havefnubb,项目名称:havefnubb,代码行数:12,代码来源:hfnucat.class.php


示例6: savecreate

 function savecreate()
 {
     $form = $this->_getForm();
     $form->initFromRequest();
     $rep = $this->getResponse('redirect');
     if ($form == null) {
         $rep->action = $this->_getAction('index');
         return $rep;
     }
     if ($form->check() && $this->_checkData($form, false)) {
         extract($form->prepareDaoFromControls($this->dao, null, $this->dbProfile), EXTR_PREFIX_ALL, "form");
         $dao = jDao::get('emails');
         if ($dao->get($form->getData('email')) == null) {
             $form_dao->insert($form_daorec);
             $id = $form_daorec->getPk();
             $form->saveAllFiles($this->uploadsDirectory);
             $rep->action = 'NewsLetter~emails:confirm';
             $this->_afterCreate($form, $id, $rep);
             jForms::destroy($this->form);
             $rep->params['id'] = $id;
             return $rep;
         } else {
             $rep->action = 'NewsLetter~emails:alreadyIn';
             return $rep;
         }
     } else {
         $rep->action = 'NewsLetter~emails:create';
         return $rep;
     }
 }
开发者ID:alienpham,项目名称:helenekling,代码行数:30,代码来源:emails.classic.php


示例7: _prepareTpl

 /**
  * function to manage data before assigning to the template of its zone
  */
 protected function _prepareTpl()
 {
     $id = (int) $this->param('id');
     if ($id) {
         $this->_tpl->assign('user', jDao::get('havefnubb~member')->getById($id));
     }
 }
开发者ID:havefnubb,项目名称:havefnubb,代码行数:10,代码来源:memberprofile.zone.php


示例8: onHfnuSearchEngineAddContent

 /**
  * updating the search_words table for each of the following event
  */
 function onHfnuSearchEngineAddContent($event)
 {
     $id = $event->getParam('id');
     $ds = $event->getParam('datasource');
     $strId = '';
     if (is_array($id)) {
         for ($i = 0; $i < count($id); $i++) {
             $strId .= $id[$i];
         }
     } else {
         $strId = $id;
     }
     // 1) get the column definition we whish to index in the search engine
     $HfnuSearchConfig = parse_ini_file(jApp::configPath() . 'havefnu.search.ini.php', true);
     //getting the column name on which we need to make the query
     $indexSubject = $HfnuSearchConfig[$ds]['index_subject'];
     $indexMessage = $HfnuSearchConfig[$ds]['index_message'];
     // 2) get the Datas we just added
     $dao = jDao::get($ds);
     $rec = $dao->get($id);
     $subject = $indexSubject != '' ? $rec->{$indexSubject} : '';
     $message = $indexMessage != '' ? $rec->{$indexMessage} : '';
     // 3) get the service and initialize the needed properties
     jClasses::inc('hfnusearch~search_index');
     $service = new search_index($strId, $ds, $subject, $message);
     // update the SearchWords table !
     $service->searchEngineUpdate();
 }
开发者ID:havefnubb,项目名称:havefnubb,代码行数:31,代码来源:searchwords.listener.php


示例9: check

 /**
  * check if there is a flood
  * @param integer $timeInterval time between two actions
  * @param integer $onlySameIp  true: the flood is checked only between same ip
  * @return boolean  true if flood is detected
  */
 public static function check($timeInterval, $onlySameIp)
 {
     // since we don't store data of anonymous user, and anonymous user
     // are not allowed to post, we don't check
     if (!jAuth::isConnected()) {
         return false;
     }
     // check if the user is member of Admins (groupid 0) / Moderators (groupid 3)
     // if so, no need to stop the action of this group of users
     // FIXME we should check, not the group, but the rights !
     foreach (jAcl2DbUserGroup::getGroupList() as $grp) {
         if ($grp->id_aclgrp == 'admins' or $grp->id_aclgrp == 'moderators') {
             return false;
         }
     }
     $dao = jDao::get('havefnubb~posts');
     $rec = $dao->getMyLastEditedPost(jAuth::getUserSession()->id);
     if ($rec->member_last_post + $timeInterval > time()) {
         return false;
     }
     if ($onlySameIp && isset($_SERVER['REMOTE_ADDR']) && $rec->poster_ip != $_SERVER['REMOTE_ADDR']) {
         return false;
     }
     return true;
 }
开发者ID:havefnubb,项目名称:havefnubb,代码行数:31,代码来源:flood.class.php


示例10: sendMail

 /**
  * Send an email to the members that have subsribe to this post
  * @param integer $id of the subscribed post
  * @return void
  */
 public static function sendMail($id)
 {
     if (!jAuth::isConnected()) {
         return;
     }
     $dao = jDao::get(self::$daoSub);
     $memberDao = jDao::get('havefnubb~member');
     //get all the members that subscribe to this thread except "ME" !!!
     $records = $dao->findSubscribedPost($id, jAuth::getUserSession()->id);
     $gJConfig = jApp::config();
     // then send them a mail
     foreach ($records as $record) {
         //get all the member that subscribe to the thread id $id (called by hfnupost -> savereply )
         $thread = jClasses::getService('havefnubb~hfnuposts')->getThread($id);
         $post = jClasses::getService('havefnubb~hfnuposts')->getPost($thread->id_last_msg);
         //get the email of the member that subscribes this thread
         $member = $memberDao->getById($record->id_user);
         $subject = jLocale::get('havefnubb~post.new.comment.received') . " : " . $post->subject;
         $mail = new jMailer();
         $mail->From = $gJConfig->mailer['webmasterEmail'];
         $mail->FromName = $gJConfig->mailer['webmasterName'];
         $mail->Sender = $gJConfig->mailer['webmasterEmail'];
         $mail->Subject = $subject;
         $tpl = new jTpl();
         $tpl->assign('server', $_SERVER['SERVER_NAME']);
         $tpl->assign('post', $post);
         $tpl->assign('login', $member->login);
         $mail->Body = $tpl->fetch('havefnubb~new_comment_received', 'text');
         $mail->AddAddress($member->email);
         $mail->Send();
     }
 }
开发者ID:havefnubb,项目名称:havefnubb,代码行数:37,代码来源:hfnusub.class.php


示例11: _beforeSaveUpdate

 protected function _beforeSaveUpdate($form, $form_daorec, $id)
 {
     if ($form->getData('flyer') == "") {
         $dao = jDao::get('events');
         $rec = $dao->get($form_daorec->id);
         $form_daorec->flyer = $rec->flyer;
     }
 }
开发者ID:alienpham,项目名称:helenekling,代码行数:8,代码来源:events.classic.php


示例12: _prepareTpl

 protected function _prepareTpl()
 {
     $id = jAuth::getUserSession()->id;
     $title = jLocale::get("jmessenger~message.msg.inbox");
     $dao = jDao::get($this->dao);
     $msg = $dao->getRecus($id);
     $this->_tpl->assign(compact('msg', 'id', 'title'));
 }
开发者ID:jelix,项目名称:jcommunity-module,代码行数:8,代码来源:inbox.zone.php


示例13: _prepareTpl

 protected function _prepareTpl()
 {
     $id = $this->getParam("id", jAuth::getUserSession()->id);
     $title = jLocale::get("jmessenger~message.msg.archived");
     $dao = jDao::get($this->dao);
     $msg = $dao->getArchive($id);
     $send = true;
     $this->_tpl->assign(compact('msg', 'id', 'title', 'send'));
 }
开发者ID:havefnubb,项目名称:havefnubb,代码行数:9,代码来源:archive.zone.php


示例14: verifyPassword

 public function verifyPassword($login, $password)
 {
     if (trim($password) == '') {
         return false;
     }
     $daouser = jDao::get($this->_params['dao'], $this->_params['profile']);
     $user = $daouser->getByLoginPassword($login, $this->cryptPassword($password));
     return $user ? $user : false;
 }
开发者ID:hadrienl,项目名称:jelix,代码行数:9,代码来源:db.auth.php


示例15: _markAsRead

 protected function _markAsRead()
 {
     $dao = jDao::get($this->dao);
     $m = $dao->get($this->param("id", 0));
     if ($m && $m->id_for == jAuth::getUserSession()->id) {
         $m->isSeen = 1;
         $dao->update($m);
     }
 }
开发者ID:havefnubb,项目名称:havefnubb,代码行数:9,代码来源:jmessenger.classic.php


示例16: testEvents

 function testEvents()
 {
     global $TEST_DAO_EVENTS;
     $TEST_DAO_EVENTS = array();
     $this->emptyTable('product_test');
     $dao = jDao::get('products_events');
     $prod1 = jDao::createRecord('products_events');
     $prod1->name = 'assiette';
     $prod1->price = 3.87;
     $prod2 = jDao::createRecord('products_events');
     $prod2->name = 'assiette';
     $prod2->price = 3.87;
     //$prod2 = clone $prod1;
     $res = $dao->insert($prod2);
     $this->assertTrue(isset($TEST_DAO_EVENTS['onDaoInsertBefore']));
     $this->assertTrue(isset($TEST_DAO_EVENTS['onDaoInsertAfter']));
     $this->assertEqual($TEST_DAO_EVENTS['onDaoInsertBefore']['dao'], 'jelix_tests~products_events');
     $this->assertEqual($TEST_DAO_EVENTS['onDaoInsertBefore']['record'], $prod1);
     $this->assertEqual($TEST_DAO_EVENTS['onDaoInsertAfter']['dao'], 'jelix_tests~products_events');
     $this->assertEqual($TEST_DAO_EVENTS['onDaoInsertAfter']['record'], $prod2);
     $prod2->name = 'nouvelle assiette';
     $prod = $dao->update($prod2);
     $this->assertTrue(isset($TEST_DAO_EVENTS['onDaoUpdateBefore']));
     $this->assertTrue(isset($TEST_DAO_EVENTS['onDaoUpdateAfter']));
     $this->assertEqual($TEST_DAO_EVENTS['onDaoUpdateBefore']['dao'], 'jelix_tests~products_events');
     $this->assertEqual($TEST_DAO_EVENTS['onDaoUpdateBefore']['record'], $prod2);
     $this->assertEqual($TEST_DAO_EVENTS['onDaoUpdateAfter']['dao'], 'jelix_tests~products_events');
     $this->assertEqual($TEST_DAO_EVENTS['onDaoUpdateAfter']['record'], $prod2);
     $dao->delete(0);
     // unexistant id
     $this->assertTrue(isset($TEST_DAO_EVENTS['onDaoDeleteBefore']));
     $this->assertTrue(isset($TEST_DAO_EVENTS['onDaoDeleteAfter']));
     $this->assertEqual($TEST_DAO_EVENTS['onDaoDeleteBefore']['dao'], 'jelix_tests~products_events');
     $this->assertEqual($TEST_DAO_EVENTS['onDaoDeleteBefore']['keys'], array('id' => 0));
     $this->assertEqual($TEST_DAO_EVENTS['onDaoDeleteAfter']['dao'], 'jelix_tests~products_events');
     $this->assertEqual($TEST_DAO_EVENTS['onDaoDeleteAfter']['keys'], array('id' => 0));
     $this->assertEqual($TEST_DAO_EVENTS['onDaoDeleteAfter']['result'], 0);
     $dao->delete($prod2->id);
     $this->assertTrue(isset($TEST_DAO_EVENTS['onDaoDeleteBefore']));
     $this->assertTrue(isset($TEST_DAO_EVENTS['onDaoDeleteAfter']));
     $this->assertEqual($TEST_DAO_EVENTS['onDaoDeleteBefore']['dao'], 'jelix_tests~products_events');
     $this->assertEqual($TEST_DAO_EVENTS['onDaoDeleteBefore']['keys'], array('id' => $prod2->id));
     $this->assertEqual($TEST_DAO_EVENTS['onDaoDeleteAfter']['dao'], 'jelix_tests~products_events');
     $this->assertEqual($TEST_DAO_EVENTS['onDaoDeleteAfter']['keys'], array('id' => $prod2->id));
     $this->assertEqual($TEST_DAO_EVENTS['onDaoDeleteAfter']['result'], 1);
     $conditions = jDao::createConditions();
     $conditions->addCondition('id', '=', $prod2->id);
     $dao->deleteBy($conditions);
     $this->assertTrue(isset($TEST_DAO_EVENTS['onDaoDeleteByBefore']));
     $this->assertTrue(isset($TEST_DAO_EVENTS['onDaoDeleteByAfter']));
     $this->assertEqual($TEST_DAO_EVENTS['onDaoDeleteByBefore']['dao'], 'jelix_tests~products_events');
     $this->assertEqual($TEST_DAO_EVENTS['onDaoDeleteByBefore']['criterias'], $conditions);
     $this->assertEqual($TEST_DAO_EVENTS['onDaoDeleteByAfter']['dao'], 'jelix_tests~products_events');
     $this->assertEqual($TEST_DAO_EVENTS['onDaoDeleteByAfter']['result'], 0);
     $this->assertEqual($TEST_DAO_EVENTS['onDaoDeleteByAfter']['criterias'], $conditions);
 }
开发者ID:hadrienl,项目名称:jelix,代码行数:56,代码来源:jdao.events.html_cli.php


示例17: searchInAuthors

 /**
  * Search in Author
  * @param string $string the request to search
  * @param string $param the id forum in which to make the request
  * @return recordset
  */
 function searchInAuthors($string, $param = '', $page = 0, $limit)
 {
     $dao = jDao::get('havefnubb~posts');
     $records = $dao->findByAuthor($string, $page, $limit);
     $result = array();
     foreach ($records as $record) {
         $result[] = (array) $record;
     }
     return array('datas' => $result, 'total' => count($result));
 }
开发者ID:havefnubb,项目名称:havefnubb,代码行数:16,代码来源:search_in.class.php


示例18: jtpl_function_html_censored_by

/**
 * function that display the nickname of the admin that censored the post
 */
function jtpl_function_html_censored_by($tpl, $id)
{
    $user = jDao::get('havefnubb~member')->getById($id);
    $str = jLocale::get('havefnubb~main.censored.by');
    if ($user->nickname != '') {
        echo $str . ' ' . $user->nickname;
    } else {
        echo $str . ' ' . $user->login;
    }
}
开发者ID:havefnubb,项目名称:havefnubb,代码行数:13,代码来源:function.censored_by.php


示例19: onAuthNewUser

 public function onAuthNewUser($event)
 {
     $id = $event->getParam('user')->id;
     if (!$id or $id == 0) {
         return;
     }
     $request_date = date('Y-m-d H:i:s');
     $dao = jDao::get('havefnubb~member');
     $dao->updateNbMsgAfterCreatingAccount($id, $request_date);
 }
开发者ID:havefnubb,项目名称:havefnubb,代码行数:10,代码来源:hfnumanageuser.listener.php


示例20: _prepareTpl

 protected function _prepareTpl()
 {
     $id_cat = $this->param('id_cat');
     if (!$id_cat) {
         return;
     }
     $dao = jDao::get('havefnubb~forum');
     $forums = $dao->findParentByCatId($id_cat);
     $this->_tpl->assign('tableclass', 'forumList');
     $this->_tpl->assign('forums', $forums);
 }
开发者ID:havefnubb,项目名称:havefnubb,代码行数:11,代码来源:forum.zone.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP jDb类代码示例发布时间:2022-05-23
下一篇:
PHP jClasses类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap