本文整理汇总了PHP中jClasses::getService方法的典型用法代码示例。如果您正苦于以下问题:PHP jClasses::getService方法的具体用法?PHP jClasses::getService怎么用?PHP jClasses::getService使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类jClasses
的用法示例。
在下文中一共展示了jClasses::getService方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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();
}
}
示例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: 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;
}
示例5: _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'));
}
示例6: _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);
}
示例7: onHfnuSearchEngineRun
function onHfnuSearchEngineRun($event)
{
$HfnuSearchConfig = parse_ini_file(jApp::configPath() . 'havefnu.search.ini.php', true);
$cleaner = jClasses::getService('hfnusearch~cleaner');
$words = $cleaner->stemPhrase($event->getParam('string'));
$nb_words = count($words);
// no words ; go back with nothing :P
if (!$words) {
return array('count' => 0, 'result' => array());
}
$service = jClasses::getService($HfnuSearchConfig['classToPerformSearchEngine']);
$result = $service->searchEngineRun($event);
}
示例8: save
function save()
{
$f = jForms::fill('base~formauth');
if (!$f->check) {
$vue = $this->getResponse('redirect');
$vue->action = 'base~identity:index';
return $vue;
}
$vue = $this->common();
$c = jClasses::getService('UserManager');
$c->save($f);
return $vue;
}
示例9: index
/**
* Index that will display all the available theme to be used
*/
function index()
{
$tpl = new jTpl();
$themes = jClasses::getService('themes');
$lists = $themes->lists();
$tpl->assign('themes', $lists);
$tpl->assign('lang', jApp::config()->locale);
$tpl->assign('current_theme', strtolower(jApp::config()->theme));
$rep = $this->getResponse('html');
$rep->body->assign('MAIN', $tpl->fetch('theme'));
$rep->body->assign('selectedMenuItem', 'theme');
return $rep;
}
示例10: _prepareTpl
/**
* function to manage data before assigning to the template of its zone
*/
protected function _prepareTpl()
{
$srvinfos = jClasses::getService("servinfo~serverinfos");
list($records, $size) = $srvinfos->dbSize();
$this->_tpl->assign('LOADS_AVG', $srvinfos->loadsAvg());
$this->_tpl->assign('CACHE_ENGINE', $srvinfos->cacheEngine());
$this->_tpl->assign('PHP_VERSION', phpversion());
$this->_tpl->assign('PHP_OS', PHP_OS);
$this->_tpl->assign('DB_VERSION', $srvinfos->dbVersion());
$this->_tpl->assign('DB_SIZE', $size);
$this->_tpl->assign('DB_RECORDS', $records);
$this->_tpl->assign('otherInfos', jEvent::notify('servinfoGetInfo')->getResponse());
}
示例11: jtpl_function_html_post_status
/**
* function that display the status of one post or post in a given forum
*/
function jtpl_function_html_post_status($tpl, $source, $data, $lastMarkThreadAsRead = 0, $forum = null)
{
$statusAvailable = array('pined', 'pinedclosed', 'opened', 'closed', 'censored', 'uncensored', 'hidden');
if ($source == 'forum') {
$id_forum = $data;
// does the user still read everything in the forum ?
if (!jClasses::getService('havefnubb~hfnuposts')->getCountUnreadThreadbyForumId($id_forum)) {
//yes
$status = 'forumicone';
} else {
$status = 'forumiconenew';
}
} elseif ($source == 'post') {
$post = $data;
$status = $statusAvailable[$post->status_thread - 1];
if (jAuth::isConnected()) {
//opened thread ?
if ($post->status_thread == 3) {
//do the member already read that post ?
// yes so status is opened
if ($post->date_last_post < $lastMarkThreadAsRead || $post->date_read_post >= $post->date_last_post) {
$status = 'opened';
} else {
// no so post is new
$status = 'post-new';
}
}
}
// does this forum manage auto-expiration ?
$dayInSecondes = 24 * 60 * 60;
$dateDiff = $post->date_modified == 0 ? floor((time() - $post->date_created) / $dayInSecondes) : floor((time() - $post->date_modified) / $dayInSecondes);
//if forum has expired ...
if ($forum->post_expire > 0 and $dateDiff >= $forum->post_expire) {
//close the thread
$status = 'closed';
}
$gJConfig = jApp::config();
$important = false;
if ($post->status_thread != 5 and $post->status_thread != 7) {
if ($post->nb_replies >= $gJConfig->havefnubb['important_nb_replies']) {
$important = true;
}
if ($post->nb_viewed >= $gJConfig->havefnubb['important_nb_views']) {
$important = true;
}
}
$status = $important === true ? $status . '_important' : $status;
}
echo $status;
}
示例12: _prepareTpl
/**
* function to manage data before assigning to the template of its zone
*/
protected function _prepareTpl()
{
$tag = $this->param('tag');
$srvTags = jClasses::getService("jtags~tags");
$tags = $srvTags->getSubjectsByTags($tag, "forumscope");
$posts = array();
// We check the rights access to the posts in the template
foreach ($tags as $tag) {
if (jClasses::getService('havefnubb~hfnuposts')->getPost($tag) !== false) {
$posts[] = jClasses::getService('havefnubb~hfnuposts')->getPost($tag);
}
}
$this->_tpl->assign('posts', $posts);
}
示例13: reindexing
/**
* Reindexing the search engine
*/
function reindexing()
{
$confirm = $this->param('confirm');
if ($confirm == 'Y') {
$idx = jClasses::getService('hfnusearch~search_index');
$nbWords = $idx->searchEngineReindexing();
jMessage::add(jLocale::get('hfnusearch~search.admin.reindexing.done', $nbWords));
} else {
jMessage::add(jLocale::get('hfnusearch~search.admin.reindexing.canceled'));
}
$rep = $this->getResponse('redirect');
$rep->action = 'hfnusearch~admin:index';
return $rep;
}
示例14: searchEngineRun
/**
* default searchEngineRun methode which make a search from the engine by querying the table define in the dao of the hfnusearch.ini.php file
* @param object $event
*/
function searchEngineRun($event)
{
$cleaner = jClasses::getService('hfnusearch~cleaner');
$words = $cleaner->stemPhrase($event->getParam('string'));
$page = (int) $event->getParam('page');
$limit = (int) $event->getParam('limit');
$id_forum = (int) $event->getParam('id_forum');
// no words ; go back with nothing :P
if (!$words) {
return array('count' => 0, 'result' => array());
}
//1) open the config file
$HfnuSearchConfig = parse_ini_file(jApp::configPath() . 'havefnu.search.ini.php', true);
//2) get the dao we want to read
$dataSource = $HfnuSearchConfig['dao'];
//3) build an array with each one
$dataSources = preg_split('/,/', $dataSource);
foreach ($dataSources as $ds) {
//4) get a factory of the current DAO
$dao = jDao::get($ds);
//getting the column name on which we need to make the query
$indexSubject = $HfnuSearchConfig[$ds]['index_subject'];
$indexMessage = $HfnuSearchConfig[$ds]['index_message'];
//5) get all the record
$conditions = jDao::createConditions();
$conditions->startGroup('OR');
if ($id_forum > 0) {
$conditions->addCondition('id_forum', '=', $id_forum);
}
foreach ($words as $word) {
$conditions->addCondition($indexSubject, 'LIKE', '%' . $word . '%');
$conditions->addCondition($indexMessage, 'LIKE', '%' . $word . '%');
}
$conditions->endGroup();
$allRecord = $dao->findBy($conditions);
if ($page > 0 and $limit > 0) {
$record = $dao->findBy($conditions, $page, $limit);
} else {
$record = $allRecord;
}
foreach ($record as $rec) {
if (jAcl2::check('hfnu.admin.post')) {
$event->Add(array('SearchEngineResult' => $rec, 'SearchEngineResultTotal' => $allRecord->rowCount()));
} elseif (jAcl2::check('hfnu.forum.view', 'forum' . $rec->id_forum) and $rec->status < 7) {
$event->Add(array('SearchEngineResult' => $rec, 'SearchEngineResultTotal' => $allRecord->rowCount()));
}
}
}
}
示例15: rate_ajax_it
/**
*Put a rate (in ajax)
*/
function rate_ajax_it()
{
//info about the "source" from where the datas come from
$id_source = $this->intParam('id_source');
$source = $this->param('source');
//check if the cancel button was selected
if ($id_source == 0 or $source == '') {
return $this->getResponse('htmlfragment');
}
$rate = $this->floatParam('star1');
jClasses::getService('hfnurates~rates')->saveRatesBySource($id_source, $source, $rate);
$result = jClasses::getService('hfnurates~rates')->getTotalRatesBySource($id_source, $source);
$rep = $this->getResponse('htmlfragment');
$rep->addContent(jLocale::get('hfnurates~main.total.of.rates') . ':' . $result->total_rates . ' ' . jLocale::get('hfnurates~main.rate') . ':' . $result->avg_level);
return $rep;
}