本文整理汇总了PHP中jDao::get方法的典型用法代码示例。如果您正苦于以下问题:PHP jDao::get方法的具体用法?PHP jDao::get怎么用?PHP jDao::get使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类jDao
的用法示例。
在下文中一共展示了jDao::get方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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;
}
示例2: 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();
}
}
示例3: _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));
}
}
示例4: 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;
}
示例5: index
/**
* list all users
*/
function index()
{
$offset = $this->intParam('offset', 0, true);
$rep = $this->getResponse('html');
if ($this->form == '') {
$rep->body->assign('MAIN', 'no form defined in the auth plugin');
return $rep;
}
$tpl = new jTpl();
$dao = jDao::get($this->dao, $this->dbProfile);
$cond = jDao::createConditions();
$cond->addItemOrder('login', 'asc');
$tpl->assign('list', $dao->findBy($cond, $offset, $this->listPageSize));
$pk = $dao->getPrimaryKeyNames();
$tpl->assign('primarykey', $pk[0]);
$tpl->assign('controls', jForms::create($this->form, '___$$$___')->getControls());
$tpl->assign('listPageSize', $this->listPageSize);
$tpl->assign('page', $offset);
$tpl->assign('recordCount', $dao->countAll());
$tpl->assign('cancreate', jAcl2::check('auth.users.create'));
$tpl->assign('canview', jAcl2::check('auth.users.view'));
$rep->body->assign('MAIN', $tpl->fetch('crud_list'));
jForms::destroy($this->form, '___$$$___');
return $rep;
}
示例6: 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();
}
示例7: 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;
}
}
示例8: 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];
}
示例9: 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;
}
示例10: 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;
}
示例11: 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;
}
示例12: index
/**
* list all users
*/
function index()
{
$offset = $this->intParam('offset', 0, true);
$rep = $this->getResponse('html');
if ($this->form == '') {
$rep->body->assign('MAIN', 'no form defined in the auth plugin');
return $rep;
}
$tpl = new jTpl();
$dao = jDao::get($this->dao, $this->dbProfile);
if (isset($_SESSION['AUTHDB_CRUD_LISTORDER'])) {
$listOrder = $_SESSION['AUTHDB_CRUD_LISTORDER'];
} else {
$listOrder = array('login' => 'asc');
}
if (($lo = $this->param('listorder')) && in_array($lo, $this->propertiesForList)) {
if (isset($listOrder[$lo]) && $listOrder[$lo] == 'asc') {
$listOrder[$lo] = 'desc';
} elseif (isset($listOrder[$lo]) && $listOrder[$lo] == 'desc') {
unset($listOrder[$lo]);
} else {
$listOrder[$lo] = 'asc';
}
$_SESSION['AUTHDB_CRUD_LISTORDER'] = $listOrder;
}
$cond = jDao::createConditions();
foreach ($listOrder as $name => $order) {
$cond->addItemOrder($name, $order);
}
$filter = trim($this->param('filter'));
if ($filter && count($this->filteredProperties)) {
if (count($this->filteredProperties) == 1) {
$cond->addCondition($this->filteredProperties[0], 'LIKE', '%' . $filter . '%');
} else {
$cond->startGroup('OR');
foreach ($this->filteredProperties as $prop) {
$cond->addCondition($prop, 'LIKE', '%' . $filter . '%');
}
$cond->endGroup();
}
}
$tpl->assign('list', $dao->findBy($cond, $offset, $this->listPageSize));
$pk = $dao->getPrimaryKeyNames();
$tpl->assign('primarykey', $pk[0]);
$tpl->assign('showfilter', count($this->filteredProperties));
$tpl->assign('filter', $filter);
$tpl->assign('listOrder', $listOrder);
$tpl->assign('propertiesList', $this->propertiesForList);
$tpl->assign('controls', jForms::create($this->form, '___$$$___')->getControls());
$tpl->assign('listPageSize', $this->listPageSize);
$tpl->assign('page', $offset);
$tpl->assign('recordCount', $dao->countAll());
$tpl->assign('cancreate', jAcl2::check('auth.users.create'));
$tpl->assign('canview', jAcl2::check('auth.users.view'));
$rep->body->assign('MAIN', $tpl->fetch('crud_list'));
$rep->body->assign('selectedMenuItem', 'users');
jForms::destroy($this->form, '___$$$___');
return $rep;
}
示例13: _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'));
}
示例14: _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;
}
}
示例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);
}
}