本文整理汇总了PHP中jClasses类的典型用法代码示例。如果您正苦于以下问题:PHP jClasses类的具体用法?PHP jClasses怎么用?PHP jClasses使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了jClasses类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _prepareTpl
protected function _prepareTpl()
{
jClasses::inc('masterAdminMenuItem');
$menu = array();
$menu['toplinks'] = new masterAdminMenuItem('toplinks', '', '');
$dashboard = new masterAdminMenuItem('dashboard', jLocale::get('gui.menu.item.dashboard'), jUrl::get('default:index'));
$dashboard->icon = $GLOBALS['gJConfig']->urlengine['jelixWWWPath'] . 'design/images/dashboard.png';
$menu['toplinks']->childItems[] = $dashboard;
$menu['system'] = new masterAdminMenuItem('system', jLocale::get('gui.menu.item.system'), '', 100);
$items = jEvent::notify('masteradminGetMenuContent')->getResponse();
foreach ($items as $item) {
if ($item->parentId) {
if (!isset($menu[$item->parentId])) {
$menu[$item->parentId] = new masterAdminMenuItem($item->parentId, '', '');
}
$menu[$item->parentId]->childItems[] = $item;
} else {
if (isset($menu[$item->id])) {
$menu[$item->id]->copyFrom($item);
} else {
$menu[$item->id] = $item;
}
}
}
usort($menu, "masterAdminItemSort");
foreach ($menu as $topitem) {
usort($topitem->childItems, "masterAdminItemSort");
}
$this->_tpl->assign('menuitems', $menu);
$this->_tpl->assign('selectedMenuItem', $this->param('selectedMenuItem', ''));
}
示例2: index
/**
* Main page
*/
function index()
{
$title = stripslashes(jApp::config()->havefnubb['title']);
$rep = $this->getResponse('html');
$historyPlugin = jApp::coord()->getPlugin('history');
$historyPlugin->change('label', ucfirst(htmlentities($title, ENT_COMPAT, 'UTF-8')));
$historyPlugin->change('title', jLocale::get('havefnubb~main.goto_homepage'));
$forums = jClasses::getService('hfnuforum');
$forumsList = $forums->getFullList();
// generate rss links list
foreach ($forumsList->getLinearIterator() as $f) {
// get the list of forum to build the RSS link
$url = jUrl::get('havefnubb~posts:rss', array('ftitle' => $f->record->forum_name, 'id_forum' => $f->record->id_forum));
$rep->addHeadContent('<link rel="alternate" type="application/rss+xml" title="' . $f->record->forum_name . ' - RSS" href="' . htmlentities($url) . '" />');
$url = jUrl::get('havefnubb~posts:atom', array('ftitle' => $f->record->forum_name, 'id_forum' => $f->record->id_forum));
$rep->addHeadContent('<link rel="alternate" type="application/atom+xml" title="' . $f->record->forum_name . ' - ATOM " href="' . htmlentities($url) . '" />');
}
$tpl = new jTpl();
$tpl->assign('selectedMenuItem', 'community');
$tpl->assign('currentIdForum', 0);
$tpl->assign('action', 'index');
$tpl->assign('forumsList', $forumsList);
$rep->body->assign('MAIN', $tpl->fetch('havefnubb~index'));
return $rep;
}
示例3: onhfnuGetMenuContent
/**
* Main Menu of the navbar
* @pararm event $event Object of a listener
*/
function onhfnuGetMenuContent($event)
{
$gJConfig = jApp::config();
$event->add(new hfnuMenuItem('home', jLocale::get('havefnubb~main.home'), jUrl::get('havefnubb~default:index'), 1, 'main'));
$event->add(new hfnuMenuItem('members', jLocale::get('havefnubb~main.member.list'), jUrl::get('havefnubb~members:index'), 2, 'main'));
$event->add(new hfnuMenuItem('search', jLocale::get('havefnubb~main.search'), jUrl::get('hfnusearch~default:index'), 3, 'main'));
if ($gJConfig->havefnubb['rules'] != '') {
$event->add(new hfnuMenuItem('rules', jLocale::get('havefnubb~main.rules'), jUrl::get('havefnubb~default:rules'), 4, 'main'));
}
// dynamic menu
$menus = jClasses::getService('havefnubb~hfnumenusbar')->getMenus();
if (!empty($menus)) {
foreach ($menus as $indx => $menu) {
$event->add(new hfnuMenuItem($menu['itemName'], $menu['name'], $menu['url'], 50 + $menu['order'], 'main'));
}
}
if ($event->getParam('admin') === true) {
$url = '';
try {
// let's try to retrieve the url of the admin, if the admin is in
// the same app
$url = jUrl::get('hfnuadmin~default:index');
} catch (Exception $e) {
if (isset($gJConfig->havefnubb["admin_url"])) {
$url = $gJConfig->havefnubb["admin_url"];
}
}
if ($url) {
$event->add(new hfnuMenuItem('admin', jLocale::get('havefnubb~main.admin.panel'), $url, 100, 'main'));
}
}
}
示例4: testCall
public function testCall()
{
jClasses::inc('jelix_tests~testCache');
$myClass = new testCache();
$returnData = jCache::call(array('testCache', 'staticMethod'), array(1, 2), 0, $this->profile);
$this->assertTrue($returnData == 3);
$dataCached = jCache::get(md5(serialize(array('testCache', 'staticMethod')) . serialize(array(1, 2))), $this->profile);
$this->assertTrue($dataCached == $returnData);
try {
jCache::call(array('testCache', 'missingStaticMethod'), null, 0, $this->profile);
$this->fail();
} catch (jException $e) {
$this->pass();
}
$returnData = jCache::call(array($myClass, 'method'), array(1, 2), 0, $this->profile);
$this->assertTrue($returnData == 3);
$dataCached = jCache::get(md5(serialize(array($myClass, 'method')) . serialize(array(1, 2))), $this->profile);
$this->assertTrue($dataCached == $returnData);
try {
jCache::call(array($myClass, 'missingMethod'), null, 0, $this->profile);
$this->fail();
} catch (jException $e) {
$this->pass();
}
$returnData = jCache::call('testFunction', array(1, 2), 0, $this->profile);
$this->assertTrue($returnData == 3);
$dataCached = jCache::get(md5(serialize('testFunction') . serialize(array(1, 2))), $this->profile);
$this->assertTrue($dataCached == $returnData);
try {
jCache::call('testFunction_missing', null, 0, $this->profile);
$this->fail();
} catch (jException $e) {
$this->pass();
}
}
示例5: 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();
}
}
示例6: _prepareTpl
/**
* function to manage data before assigning to the template of its zone
*/
protected function _prepareTpl()
{
jClasses::inc('havefnubb~hfnuMenuItem');
$admin = jAcl2::check('hfnu.admin.index');
$menu = array();
$items = jEvent::notify('hfnuGetMenuContent', array('admin' => $admin))->getResponse();
foreach ($items as $item) {
if ($item->parentId) {
if (!isset($menu[$item->parentId])) {
$menu[$item->parentId] = new hfnuMenuItem($item->parentId, '', '');
}
$menu[$item->parentId]->childItems[] = $item;
} else {
if (isset($menu[$item->id])) {
$menu[$item->id]->copyFrom($item);
} else {
$menu[$item->id] = $item;
}
}
}
usort($menu, "hfnuItemSort");
foreach ($menu as $topitem) {
usort($topitem->childItems, "hfnuItemSort");
}
$this->_tpl->assign('menuitems', $menu);
$this->_tpl->assign('selectedMenuItem', $this->param('selectedMenuItem', ''));
}
示例7: _prepareTpl
protected function _prepareTpl()
{
jClasses::inc('masterAdminMenuItem');
$items = jEvent::notify('masteradminGetInfoBoxContent')->getResponse();
usort($items, "masterAdminItemSort");
$this->_tpl->assign('infoboxitems', $items);
$this->_tpl->assign('user', jAuth::getUserSession());
}
示例8: unread
public function unread()
{
$rep = $this->getResponse('html');
$tpl = new jTpl();
$tpl->assign('posts', jClasses::getService('havefnubb~hfnuposts')->findUnreadThreadByMod());
$rep->body->assign('MAIN', $tpl->fetch('posts.list'));
return $rep;
}
示例9: _createInstance
protected function _createInstance()
{
if ($this->toSelector === null) {
$this->instance = null;
$this->toSelector = $this->_getClassSelector();
}
return jClasses::create($this->toSelector->toString());
}
示例10: _prepareTpl
/**
* function to manage data before assigning to the template of its zone
*/
protected function _prepareTpl()
{
list($nbAnonymous, $members, $bots) = jClasses::create('activeusers~connectedusers')->getConnectedList();
$this->_tpl->assign('nbAnonymous', $nbAnonymous);
$this->_tpl->assign('members', $members);
$this->_tpl->assign('nbMembers', count($members));
$this->_tpl->assign('bots', $bots);
}
示例11: verifyPassword
public function verifyPassword($login, $password)
{
if (trim($password) == '') {
return false;
}
$classuser = jClasses::create($this->_params['class']);
$user = $classuser->getByLoginPassword($login, $this->cryptPassword($password));
return $user ? $user : false;
}
示例12: _prepareTpl
/**
* function to manage data before assigning to the template of its zone
*/
protected function _prepareTpl()
{
$today = mktime(0, 0, 0, date("m"), date("d"), date("Y"));
list($nbAnonymous, $members, $bots) = jClasses::create('activeusers~connectedusers')->getConnectedList($today, true);
$this->_tpl->assign('nbAnonymous', $nbAnonymous);
$this->_tpl->assign('members', $members);
$this->_tpl->assign('nbMembers', count($members));
$this->_tpl->assign('bots', $bots);
}
示例13: getInstance
/**
* Get the binded instance
*
* @return mixed
*/
public function getInstance()
{
if ($this->instance === null) {
if ($this->toSelector === null) {
$this->toSelector = $this->_getClassSelector();
}
$this->instance = jClasses::create($this->toSelector->toString());
}
return $this->instance;
}
示例14: _prepareTpl
protected function _prepareTpl()
{
$id = $this->getParam('id', false);
$scope = $this->getParam('scope', false);
if (!$id || !$scope) {
throw new Exception(jLocale::get("jtags~tags.error.parametermissing"));
}
$tags = jClasses::getService("jtags~tags")->getTagsBySubject($scope, $id);
$this->_tpl->assign(compact('tags'));
}
示例15: _prepareTpl
/**
* function to manage data before assigning to the template of its zone
*/
protected function _prepareTpl()
{
$subs = array();
// get the threads the user subscribed
$threads = jDao::get('havefnubb~sub')->findSubscribedPostByUser(jAuth::getUserSession()->id);
foreach ($threads as $t) {
// get the thread details
$thread = jClasses::getService('havefnubb~hfnuposts')->getThread($t->id_post);
$subs[] = array('id_post' => $thread->id_last_msg, 'ptitle' => jClasses::getService('havefnubb~hfnuposts')->getPost($thread->id_last_msg)->subject, 'thread_id' => $thread->id_thread, 'id_forum' => $thread->id_forum_thread, 'ftitle' => jClasses::getService('havefnubb~hfnuforum')->getForum($thread->id_forum_thread)->forum_name);
}
$this->_tpl->assign('subs', $subs);
}