本文整理汇总了PHP中JEVHelper::getUser方法的典型用法代码示例。如果您正苦于以下问题:PHP JEVHelper::getUser方法的具体用法?PHP JEVHelper::getUser怎么用?PHP JEVHelper::getUser使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类JEVHelper
的用法示例。
在下文中一共展示了JEVHelper::getUser方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: created_by_alias
function created_by_alias()
{
if ($this->_created_by_alias != "") {
return $this->_created_by_alias;
} else {
$creator = JEVHelper::getUser($this->_created_by);
return $creator->name;
}
}
示例2: getContact
/**
* Returns contact details or user details as fall back
*
* @param int id key of user
* @param string attrib Requested attribute of the user object
* @return mixed row Attribute or row object
*/
public static function getContact($id, $attrib = 'Object')
{
$db = JFactory::getDBO();
static $rows = array();
if ($id <= 0) {
return null;
}
if (!isset($rows[$id])) {
$user = JFactory::getUser();
$rows[$id] = null;
$query = "SELECT ju.id, ju.name, ju.username, ju.sendEmail, ju.email, cd.name as contactname, " . ' CASE WHEN CHAR_LENGTH(cd.alias) THEN CONCAT_WS(\':\', cd.id, cd.alias) ELSE cd.id END as slug, ' . ' CASE WHEN CHAR_LENGTH(cat.alias) THEN CONCAT_WS(\':\', cat.id, cat.alias) ELSE cat.id END AS catslug ' . " \n FROM #__users AS ju" . "\n LEFT JOIN #__contact_details AS cd ON cd.user_id = ju.id " . "\n LEFT JOIN #__categories AS cat ON cat.id = cd.catid " . "\n WHERE block ='0'" . "\n AND cd.published =1 " . "\n AND cd.access " . (version_compare(JVERSION, '1.6.0', '>=') ? ' IN (' . JEVHelper::getAid($user) . ')' : ' <= ' . JEVHelper::getAid($user)) . "\n AND cat.access " . (version_compare(JVERSION, '1.6.0', '>=') ? ' IN (' . JEVHelper::getAid($user) . ')' : ' <= ' . JEVHelper::getAid($user)) . "\n AND ju.id = " . $id;
$db->setQuery($query);
$rows[$id] = $db->loadObject();
if (is_null($rows[$id])) {
// if the user has been deleted then try to suppress the warning
// this causes a problem in Joomla 2.5.1 on some servers
if (version_compare(JVERSION, '2.5', '>=')) {
$rows[$id] = JEVHelper::getUser($id);
} else {
$handlers = JError::getErrorHandling(2);
JError::setErrorHandling(2, "ignore");
$rows[$id] = JEVHelper::getUser($id);
foreach ($handlers as $handler) {
if (!is_array($handler)) {
JError::setErrorHandling(2, $handler);
}
}
if ($rows[$id]) {
$error = JError::getError(true);
}
}
}
}
if ($attrib == 'Object') {
return $rows[$id];
} elseif (isset($rows[$id]->{$attrib})) {
return $rows[$id]->{$attrib};
} else {
return null;
}
}
示例3: processMatch
//.........这里部分代码省略.........
}
}
if (stripos($fieldval, "%d") !== false) {
$days = intval($timedelta / (60 * 60 * 24));
$timedelta -= $days * 60 * 60 * 24;
$fieldval = str_ireplace("%d", $days, $fieldval);
$shownsign = true;
}
if (stripos($fieldval, "%h") !== false) {
$hours = intval($timedelta / (60 * 60));
$timedelta -= $hours * 60 * 60;
if ($shownsign) {
$hours = abs($hours);
}
$hours = sprintf("%02d", $hours);
$fieldval = str_ireplace("%h", $hours, $fieldval);
$shownsign = true;
}
if (stripos($fieldval, "%m") !== false) {
$mins = intval($timedelta / 60);
$timedelta -= $hours * 60;
if ($mins) {
$mins = abs($mins);
}
$mins = sprintf("%02d", $mins);
$fieldval = str_ireplace("%m", $mins, $fieldval);
}
$content .= $fieldval;
break;
case 'createdByAlias':
$content .= $dayEvent->created_by_alias();
break;
case 'createdByUserName':
$catobj = JEVHelper::getUser($dayEvent->created_by());
$content .= isset($catobj->username) ? $catobj->username : "";
break;
case 'createdByUserEmail':
// Note that users email address will NOT be available if they don't want to receive email
$catobj = JEVHelper::getUser($dayEvent->created_by());
$content .= $catobj->sendEmail ? $catobj->email : '';
break;
case 'createdByUserEmailLink':
// Note that users email address will NOT be available if they don't want to receive email
$content .= JRoute::_("index.php?option=" . $compname . "&task=" . $task_events . "&agid=" . $dayEvent->id() . "&year=" . $st_year . "&month=" . $st_month . "&day=" . $st_day . "&Itemid=" . $this->myItemid . $this->catout);
break;
case 'color':
$content .= $dayEvent->bgcolor();
break;
case 'eventDetailLink':
$link = $dayEvent->viewDetailLink($st_year, $st_month, $st_day, false, $this->myItemid);
$link = JRoute::_($link . $this->datamodel->getCatidsOutLink());
$content .= $link;
/*
$content .= JRoute::_("index.php?option="
. $compname
. "&task=".$task_events
. "&agid=".$dayEvent->id()
. "&year=".$st_year
. "&month=".$st_month
. "&day=".$st_day
. "&Itemid=".$this->myItemid . $this->catout);
*/
break;
default:
try {
if (strpos($match, '${') !== false) {
示例4: creatorName
function creatorName($show = "both")
{
if (!isset($this->_creatorname)) {
if ($show == "both") {
$user = JEVHelper::getUser($this->_created_by);
if ($user->id > 0) {
$this->_creatorname = $user->username . "(" . $user->name . ")";
} else {
if (isset($this->_anonname)) {
$this->_creatorname = $this->_anonname . "<br/>(" . $this->_anonemail . ")";
} else {
$this->_creatorname = "";
}
}
} else {
if ($show == "name") {
$user = JEVHelper::getUser($this->_created_by);
if ($user->id > 0) {
$this->_creatorname = $user->name;
} else {
if (isset($this->_anonname)) {
$this->_creatorname = $this->_anonname . "<br/>(" . $this->_anonemail . ")";
} else {
$this->_creatorname = "";
}
}
} else {
if ($show == "username") {
$user = JEVHelper::getUser($this->_created_by);
if ($user->id > 0) {
$this->_creatorname = " . {$user->username} . ";
} else {
if (isset($this->_anonname)) {
$this->_creatorname = $this->_anonname . "<br/>(" . $this->_anonemail . ")";
} else {
$this->_creatorname = "";
}
}
}
}
}
}
return $this->_creatorname;
}
示例5: listLatestIcalEvents
function listLatestIcalEvents($startdate, $enddate, $limit = 10, $noRepeats = 0, $multidayTreatment = 0)
{
//list($usec, $sec) = explode(" ", microtime());
//$starttime = (float) $usec + (float) $sec;
$userid = JRequest::getVar('jev_userid', "0");
if ($userid == "0") {
$user = JFactory::getUser();
} else {
$user = JEVHelper::getUser($userid);
}
$lang = JFactory::getLanguage();
$langtag = $lang->getTag();
if (strpos($startdate, "-") === false) {
$startdate = JevDate::strftime('%Y-%m-%d 00:00:00', $startdate);
$enddate = JevDate::strftime('%Y-%m-%d 23:59:59', $enddate);
}
// Use alternative data source
$rows = array();
$skipJEvents = false;
$dispatcher = JDispatcher::getInstance();
$dispatcher->trigger('fetchListLatestIcalEvents', array(&$skipJEvents, &$rows, $startdate, $enddate, $limit, $noRepeats, $multidayTreatment));
if ($skipJEvents) {
return $rows;
}
// process the new plugins
// get extra data and conditionality from plugins
$extrawhere = array();
$extrajoin = array();
$rptwhere = array();
$extrafields = "";
// must have comma prefix
$extratables = "";
// must have comma prefix
$needsgroup = false;
$filterarray = array("published", "justmine", "category", "search", "repeating");
// If there are extra filters from the module then apply them now
$reg = JFactory::getConfig();
$modparams = $reg->get("jev.modparams", false);
if ($modparams && $modparams->get("extrafilters", false)) {
$filterarray = array_merge($filterarray, explode(",", $modparams->get("extrafilters", false)));
}
$filters = jevFilterProcessing::getInstance($filterarray);
$filters->setWhereJoin($extrawhere, $extrajoin);
$needsgroup = $filters->needsGroupBy();
$dispatcher = JDispatcher::getInstance();
$dispatcher->trigger('onListIcalEvents', array(&$extrafields, &$extratables, &$extrawhere, &$extrajoin, &$needsgroup, &$rptwhere));
//list ($usec, $sec) = explode(" ", microtime());
//$time_end = (float) $usec + (float) $sec;
//echo "post onListIcalEvents= ".round($time_end - $starttime, 4)."<br/>";
// What if join multiplies the rows?
// Useful MySQL link http://forums.mysql.com/read.php?10,228378,228492#msg-228492
// concat with group
// http://www.mysqlperformanceblog.com/2006/09/04/group_concat-useful-group-by-extension/
// did any of the plugins adjust the range of dateds allowed eg. timelimit plugin - is so then we need to use this information otherwise we get problems
$regex = "#(rpt.endrepeat>='[0-9:\\- ]*' AND rpt.startrepeat<='[0-9:\\- ]*')#";
foreach ($extrawhere as $exwhere) {
if (preg_match($regex, $exwhere)) {
$rptwhere[] = str_replace("rpt.", "rpt2.", $exwhere);
}
}
$rptwhere = count($rptwhere) ? ' AND ' . implode(' AND ', $rptwhere) : '';
$catwhere = "\n WHERE ev.catid IN(" . $this->accessibleCategoryList(JEVHelper::getAid($user)) . ")";
$params = JComponentHelper::getParams("com_jevents");
if ($params->get("multicategory", 0)) {
$extrajoin[] = "\n #__jevents_catmap as catmap ON catmap.evid = rpt.eventid";
$extrajoin[] = "\n #__categories AS catmapcat ON catmap.catid = catmapcat.id";
$extrafields .= ", GROUP_CONCAT(DISTINCT catmap.catid SEPARATOR ',') as catids";
$extrawhere[] = " catmapcat.access IN (" . JEVHelper::getAid($user) . ")";
$extrawhere[] = " catmap.catid IN(" . $this->accessibleCategoryList() . ")";
$needsgroup = true;
$catwhere = "\n WHERE 1 ";
}
$extrajoin = count($extrajoin) ? " \n LEFT JOIN " . implode(" \n LEFT JOIN ", $extrajoin) : '';
$extrawhere = count($extrawhere) ? ' AND ' . implode(' AND ', $extrawhere) : '';
// get the event ids first - split into 2 queries to pick up the ones after now and the ones before
$t_datenow = JEVHelper::getNow();
$t_datenowSQL = $t_datenow->toSql();
// multiday condition
if ($multidayTreatment == 3) {
// We only show events once regardless of multiday setting of event so we allow them all through here!
$multiday = "";
$multiday2 = "";
$multiday3 = "";
} else {
if ($multidayTreatment == 2) {
// We only show events on their first day only regardless of multiday setting of event so we allow them all through here!
$multiday = "";
$multiday2 = "";
$multiday3 = "";
} else {
if ($multidayTreatment == 1) {
// We only show events on all days regardless of multiday setting of event so we allow them all through here!
$multiday = "";
$multiday2 = "";
$multiday3 = "";
} else {
// We only show events on their first day if they are not to be shown on multiple days so also add this condition
// i.e. the event settings are used
// This is the true version of these conditions
//$multiday = "\n AND ((rpt.startrepeat >= '$startdate' AND det.multiday=0) OR det.multiday=1)";
//.........这里部分代码省略.........
示例6: getEventData
function getEventData($rpid, $jevtype, $year, $month, $day, $uid = "")
{
$data = array();
$pop = intval(JRequest::getVar('pop', 0));
$Itemid = JEVHelper::getItemid();
$db = JFactory::getDBO();
$user = JFactory::getUser();
$cfg = JEVConfig::getInstance();
$row = $this->queryModel->listEventsById($rpid, 1, $jevtype);
// include unpublished events for publishers and above
// if the event is not published then make sure the user can edit or publish it or created it before allowing it to be seen!
if ($row && $row->published() != 1) {
if ($user->id != $row->created_by() && !JEVHelper::canEditEvent($row) && !JEVHelper::canPublishEvent($row) && !JEVHelper::isAdminUser($user)) {
$row = null;
}
}
$num_row = count($row);
// No matching rows - use uid as alternative
if ($num_row == 0 && JString::strlen($uid) > 0) {
$rpid = $this->queryModel->findMatchingRepeat($uid, $year, $month, $day);
if (isset($rpid) && $rpid > 0) {
$row = $this->queryModel->listEventsById($rpid, 1, $jevtype);
// include unpublished events for publishers and above
if ($row && !$row->published()) {
if ($user->id != $row->created_by() && !JEVHelper::canEditEvent($row) && !JEVHelper::canPublishEvent($row) && !JEVHelper::isAdminUser($user)) {
$row = null;
}
}
$num_row = count($row);
}
}
if ($num_row) {
// process the new plugins
$dispatcher = JEventDispatcher::getInstance();
$dispatcher->trigger('onGetEventData', array(&$row));
$params = new JRegistry(null);
$row->contactlink = JEventsHTML::getUserMailtoLink($row->id(), $row->created_by(), false, $row);
$event_up = new JEventDate($row->publish_up());
$row->start_date = JEventsHTML::getDateFormat($event_up->year, $event_up->month, $event_up->day, 0);
$row->start_time = JEVHelper::getTime($row->getUnixStartTime());
$event_down = new JEventDate($row->publish_down());
$row->stop_date = JEventsHTML::getDateFormat($event_down->year, $event_down->month, $event_down->day, 0);
$row->stop_time = JEVHelper::getTime($row->getUnixEndTime());
$row->stop_time_midnightFix = $row->stop_time;
$row->stop_date_midnightFix = $row->stop_date;
if ($event_down->second == 59) {
$row->stop_time_midnightFix = JEVHelper::getTime($row->getUnixEndTime() + 1);
$row->stop_date_midnightFix = JEventsHTML::getDateFormat($event_down->year, $event_down->month, $event_down->day + 1, 0);
}
// *******************
// ** This cloaking should be done by mambot/Joomla function
// *******************
// Parse http and wrap in <a> tag
// trigger content plugin
JPluginHelper::importPlugin('content');
$pattern = '[a-zA-Z0-9&?_.,=%\\-\\/]';
// Addresse
if (!is_numeric($row->location())) {
// don't convert address that already has a link tag
if (strpos($row->location(), '<a href=') === false) {
$row->location(preg_replace('#(http://)(' . $pattern . '*)#i', '<a href="\\1\\2">\\1\\2</a>', $row->location()));
}
$tmprow = new stdClass();
$tmprow->text = $row->location();
$dispatcher = JEventDispatcher::getInstance();
$dispatcher->trigger('onContentPrepare', array('com_jevents', &$tmprow, &$params, 0));
$row->location($tmprow->text);
}
//Contact
if (strpos($row->contact_info(), '<a href=') === false) {
$row->contact_info(preg_replace('#(http://)(' . $pattern . '*)#i', '<a href="\\1\\2">\\1\\2</a>', $row->contact_info()));
}
$tmprow = new stdClass();
$tmprow->text = $row->contact_info();
$dispatcher->trigger('onContentPrepare', array('com_jevents', &$tmprow, &$params, 0));
$row->contact_info($tmprow->text);
//Extra
if (strpos($row->extra_info(), '<a href=') === false) {
$row->extra_info(preg_replace('#(http://)(' . $pattern . '*)#i', '<a href="\\1\\2">\\1\\2</a>', $row->extra_info()));
}
//$row->extra_info(eregi_replace('[^(href=|href="|href=\')](((f|ht){1}tp://)[-a-zA-Z0-9@:%_\+.~#?&//=]+)','\\1', $row->extra_info()));
$tmprow = new stdClass();
$tmprow->text = $row->extra_info();
$dispatcher->trigger('onContentPrepare', array('com_jevents', &$tmprow, &$params, 0));
$row->extra_info($tmprow->text);
$mask = JFactory::getApplication()->getCfg('hideAuthor') ? MASK_HIDEAUTHOR : 0;
$mask |= JFactory::getApplication()->getCfg('hideCreateDate') ? MASK_HIDECREATEDATE : 0;
$mask |= JFactory::getApplication()->getCfg('hideModifyDate') ? MASK_HIDEMODIFYDATE : 0;
$mask |= JFactory::getApplication()->getCfg('hidePdf') ? MASK_HIDEPDF : 0;
$mask |= JFactory::getApplication()->getCfg('hidePrint') ? MASK_HIDEPRINT : 0;
$mask |= JFactory::getApplication()->getCfg('hideEmail') ? MASK_HIDEEMAIL : 0;
//$mask |= JFactory::getApplication()->getCfg( 'vote' ) ? MASK_VOTES : 0;
$mask |= JFactory::getApplication()->getCfg('vote') ? MASK_VOTES | MASK_VOTEFORM : 0;
$mask |= $pop ? MASK_POPUP | MASK_IMAGES | MASK_BACKTOLIST : 0;
// Do main mambot processing here
// process bots
//$row->text = $row->content;
$params->set("image", 1);
$row->text = $row->content();
$dispatcher->trigger('onContentPrepare', array('com_jevents', &$row, &$params, 0));
//.........这里部分代码省略.........
示例7: processMatch
//.........这里部分代码省略.........
$fieldval = $dateParm;
$shownsign = false;
if (stripos($fieldval, "%d") !== false) {
$days = intval($timedelta / (60 * 60 * 24));
$timedelta -= $days * 60 * 60 * 24;
$fieldval = str_ireplace("%d", $days, $fieldval);
$shownsign = true;
}
if (stripos($fieldval, "%h") !== false) {
$hours = intval($timedelta / (60 * 60));
$timedelta -= $hours * 60 * 60;
if ($shownsign) {
$hours = abs($hours);
}
$hours = sprintf("%02d", $hours);
$fieldval = str_ireplace("%h", $hours, $fieldval);
$shownsign = true;
}
if (stripos($fieldval, "%m") !== false) {
$mins = intval($timedelta / 60);
$timedelta -= $hours * 60;
if ($mins) {
$mins = abs($mins);
}
$mins = sprintf("%02d", $mins);
$fieldval = str_ireplace("%m", $mins, $fieldval);
}
$content .= $fieldval;
break;
case 'createdByAlias':
$content .= $dayEvent->created_by_alias();
break;
case 'createdByUserName':
$catobj = JEVHelper::getUser($dayEvent->created_by());
$content .= isset($catobj->username) ? $catobj->username : "";
break;
case 'createdByUserEmail':
// Note that users email address will NOT be available if they don't want to receive email
$catobj = JEVHelper::getUser($dayEvent->created_by());
$content .= $catobj->sendEmail ? $catobj->email : '';
break;
case 'createdByUserEmailLink':
// Note that users email address will NOT be available if they don't want to receive email
$content .= JRoute::_("index.php?option=" . $compname . "&task=" . $task_events . "&agid=" . $dayEvent->id() . "&year=" . $st_year . "&month=" . $st_month . "&day=" . $st_day . "&Itemid=" . $this->myItemid . $this->catout);
break;
case 'color':
$content .= $dayEvent->bgcolor();
break;
case 'eventDetailLink':
$link = $dayEvent->viewDetailLink($st_year, $st_month, $st_day, false, $this->myItemid);
$link = JRoute::_($link . $this->datamodel->getCatidsOutLink());
$content .= $link;
/*
$content .= JRoute::_("index.php?option="
. $compname
. "&task=".$task_events
. "&agid=".$dayEvent->id()
. "&year=".$st_year
. "&month=".$st_month
. "&day=".$st_day
. "&Itemid=".$this->myItemid . $this->catout);
*/
break;
default:
try {
if (strpos($match, '${') !== false) {
示例8: notifyAuthorPublished
public static function notifyAuthorPublished($event)
{
JLoader::register('JEventsCategory', JEV_ADMINPATH . "/libraries/categoryClass.php");
$db = JFactory::getDBO();
$cat = new JEventsCategory($db);
$cat->load($event->catid());
$adminuser = $cat->getAdminUser();
$adminEmail = $adminuser->email;
$adminName = $adminuser->name;
$config = new JConfig();
$sitename = $config->sitename;
$subject = JText::sprintf('JEV_NOTIFY_AUTHOR_SUBJECT', $sitename);
$Itemid = JEVHelper::getItemid();
// reload the event to get the reptition ids
$evid = intval($event->ev_id());
$dataModel = new JEventsDataModel("JEventsAdminDBModel");
$queryModel = new JEventsDBModel($dataModel);
$testevent = $queryModel->getEventById($evid, 1, "icaldb");
// attach anonymous creator etc.
JPluginHelper::importPlugin('jevents');
$dispatcher = JDispatcher::getInstance();
$dispatcher->trigger('onDisplayCustomFields', array(&$event));
$rp_id = $testevent->rp_id();
list($year, $month, $day) = JEVHelper::getYMD();
$uri = JURI::getInstance(JURI::base());
if (JFactory::getApplication()->isAdmin()) {
$root = $uri->toString(array('scheme', 'host', 'port', 'path'));
$root = str_replace("/administrator", "", $root);
$detaillink = '<a href="' . $root . 'index.php?option=' . JEV_COM_COMPONENT . '&task=icalrepeat.detail&rp_id=' . $evid . '&rp_id=' . $rp_id . '&Itemid=' . $Itemid . "&year={$year}&month={$month}&day={$day}" . '">' . $event->title() . '</a>' . "\n";
} else {
$root = $uri->toString(array('scheme', 'host', 'port'));
$detaillink = '<a href="' . $root . JRoute::_('index.php?option=' . JEV_COM_COMPONENT . '&task=icalrepeat.detail&rp_id=' . $evid . '&rp_id=' . $rp_id . '&Itemid=' . $Itemid . "&year={$year}&month={$month}&day={$day}") . '">' . $event->title() . '</a>' . "\n";
}
$content = sprintf(JText::_('JEV_NOTIFY_AUTHOR_Message'), $detaillink, $sitename);
$authorname = "";
$authoremail = "";
if ($event->created_by() > 0) {
$author = JEVHelper::getUser($event->created_by());
if (!$author) {
return;
}
$authorname = $author->name;
$authoremail = $author->email;
} else {
if (isset($event->authoremail) && $event->authoremail != "") {
$authorname = $event->authorname;
$authoremail = $event->authoremail;
}
}
if ($authoremail == "") {
return;
}
// mail function
$mail = JFactory::getMailer();
$mail->setSender(array(0 => $adminEmail, 1 => $adminName));
$mail->addRecipient($authoremail);
$mail->setSubject($subject);
$mail->setBody($content);
$mail->IsHTML(true);
$mail->send();
}