本文整理汇总了PHP中CParameter类的典型用法代码示例。如果您正苦于以下问题:PHP CParameter类的具体用法?PHP CParameter怎么用?PHP CParameter使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了CParameter类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: getActivityContentHTML
static function getActivityContentHTML($act)
{
// Ok, the activity could be an upload OR a wall comment. In the future, the content should
// indicate which is which
$html = '';
$param = new CParameter($act->params);
$action = $param->get('action', false);
$count = $param->get('count', false);
$config = CFactory::getConfig();
switch ($action) {
case CAdminstreamsAction::TOP_USERS:
$model = CFactory::getModel('user');
$members = $model->getPopularMember($count);
$html = '';
//Get Template Page
$tmpl = new CTemplate();
$html = $tmpl->set('members', $members)->fetch('activity.members.popular');
return $html;
break;
case CAdminstreamsAction::TOP_PHOTOS:
$model = CFactory::getModel('photos');
$photos = $model->getPopularPhotos($count, 0);
$tmpl = new CTemplate();
$html = $tmpl->set('photos', $photos)->fetch('activity.photos.popular');
return $html;
break;
case CAdminstreamsAction::TOP_VIDEOS:
$model = CFactory::getModel('videos');
$videos = $model->getPopularVideos($count);
$tmpl = new CTemplate();
$html = $tmpl->set('videos', $videos)->fetch('activity.videos.popular');
return $html;
break;
}
}
开发者ID:joshjim27,项目名称:jobsglobal,代码行数:35,代码来源:adminstreams.php
示例2: getFieldHTML
public function getFieldHTML($field, $required)
{
$html = '';
$selectedElement = 0;
$elementSelected = 0;
$elementCnt = 0;
$params = new CParameter($field->params);
$readonly = $params->get('readonly') && !COwnerHelper::isCommunityAdmin() ? ' disabled="disabled"' : '';
for ($i = 0; $i < count($field->options); $i++) {
$option = $field->options[$i];
$selected = $option == $field->value ? ' checked="checked"' : '';
if (empty($selected)) {
$elementSelected++;
}
$elementCnt++;
}
$cnt = 0;
$html .= '<div style="display:inline-block" title="' . CStringHelper::escape(JText::_($field->tips)) . '">';
for ($i = 0; $i < count($field->options); $i++) {
$option = $field->options[$i];
$selected = html_entity_decode($option) == html_entity_decode($field->value) ? ' checked="checked"' : '';
$html .= '<label class="lblradio-block">';
$html .= '<input type="radio" name="field' . $field->id . '" value="' . $option . '"' . $selected . $readonly . ' style="margin: 2px 5px 0 0" />';
$html .= JText::_($option) . '</label>';
}
$html .= '</div>';
return $html;
}
开发者ID:joshjim27,项目名称:jobsglobal,代码行数:28,代码来源:radio.php
示例3: getFieldHTML
public function getFieldHTML($field, $required)
{
$html = '';
$selectedElement = 0;
$required = $field->required == 1 ? ' data-required="true"' : '';
$style = ' style="margin: 0 5px 0 0;' . $this->getStyle() . '" ';
$params = new CParameter($field->params);
$disabled = '';
if ($params->get('readonly') == 1) {
$disabled = 'disabled="disabled"';
}
// Gender contain only male and female
$options = array("" => "COM_COMMUNITY_SELECT_GENDER", "COM_COMMUNITY_MALE" => "COM_COMMUNITY_MALE", "COM_COMMUNITY_FEMALE" => "COM_COMMUNITY_FEMALE");
$cnt = 0;
//CFactory::load( 'helpers' , 'string' );
// REMOVE 3.3
// $class = !empty($field->tips) ? 'jomNameTips tipRight' : '';
// REMOVE 3.3
// $html .= '<div class="' . $class . '" style="display: inline-block;" title="' . CStringHelper::escape(JText::_($field->tips)) . '">';
$html .= '<select class="joms-select" name="field' . $field->id . '" ' . $required . ' ' . $disabled . ' >';
foreach ($options as $key => $val) {
$selected = $key == $field->value ? ' selected="selected" ' : '';
$html .= '<option value="' . $key . '" ' . $selected . '>' . JText::_($val) . '</option>';
}
$html .= '</select>';
// REMOVE 3.3
// $html .= '<span id="errfield' . $field->id . 'msg" style="display: none;"> </span>';
// $html .= '</div>';
return $html;
}
开发者ID:joshjim27,项目名称:jobsglobal,代码行数:30,代码来源:gender.php
示例4: ajaxTogglePublish
public function ajaxTogglePublish($id, $type, $eventName = false)
{
// Send email notification to owner when a group is published.
$config = CFactory::getConfig();
$event = JTable::getInstance('Event', 'CTable');
$event->load($id);
// Added published = 2 for new created event under moderation.
if ($type == 'published' && $event->published == 2) {
$lang = JFactory::getLanguage();
$lang->load('com_community', JPATH_ROOT);
$my = CFactory::getUser();
// Add notification
//CFactory::load('libraries', 'notification');
//CFactory::load('helpers', 'event');
if ($event->type == CEventHelper::GROUP_TYPE && $event->contentid != 0) {
$url = 'index.php?option=com_community&view=events&task=viewevent&eventid=' . $event->id . '&groupid=' . $event->contentid;
} else {
$url = 'index.php?option=com_community&view=events&task=viewevent&eventid=' . $event->id;
}
//Send notification email to owner
$params = new CParameter('');
$params->set('url', 'index.php?option=com_community&view=events&task=viewevent&eventid=' . $event->id);
$params->set('event', $event->title);
$params->set('event_url', 'index.php?option=com_community&view=events&task=viewevent&eventid=' . $event->id);
CNotificationLibrary::add('events_notify_creator', $my->id, $event->creator, JText::_('COM_COMMUNITY_EVENTS_PUBLISHED_MAIL_SUBJECT'), '', 'events.notifycreator', $params);
//CFactory::load('libraries', 'events');
// Add activity stream for new created event.
$event->published = 1;
// by pass published checking.
CEvents::addEventStream($event);
// send notification email to group's member for new created event.
CEvents::addGroupNotification($event);
}
return parent::ajaxTogglePublish($id, $type, 'events');
}
开发者ID:Jougito,项目名称:DynWeb,代码行数:35,代码来源:events.php
示例5: injectTags
/**
* Inject data from paramter to content tags ({}) .
*
* @param $content Original content with content tags.
* @param $params Text contain all values need to be replaced.
* @param $html Auto detect url tag and insert inline.
* @return $text The content after replacing.
**/
public static function injectTags($content, $paramsTxt, $html = false)
{
$params = new CParameter($paramsTxt);
preg_match_all("/{(.*?)}/", $content, $matches, PREG_SET_ORDER);
if (!empty($matches)) {
foreach ($matches as $val) {
$replaceWith = JString::trim($params->get($val[1], null));
if (!is_null($replaceWith)) {
//if the replacement start with 'index.php', we can CRoute it
if (JString::strpos($replaceWith, 'index.php') === 0) {
$replaceWith = CRoute::getExternalURL($replaceWith);
}
if ($html) {
$replaceUrl = $params->get($val[1] . '_url', null);
if (!is_null($replaceUrl)) {
if ($val[1] == 'stream') {
$replaceUrl .= '#activity-stream-container';
}
//if the replacement start with 'index.php', we can CRoute it
if (JString::strpos($replaceUrl, 'index.php') === 0) {
$replaceUrl = CRoute::getExternalURL($replaceUrl);
}
$replaceWith = '<a href="' . $replaceUrl . '">' . $replaceWith . '</a>';
}
}
$content = CString::str_ireplace($val[0], $replaceWith, $content);
}
}
}
return $content;
}
开发者ID:joshjim27,项目名称:jobsglobal,代码行数:39,代码来源:content.php
示例6: getMessage
public function getMessage($field)
{
$params = new CParameter($field['params']);
if ($params->get('min_char') && $params->get('max_char') && !$this->validLength($field['value'])) {
return JText::sprintf('COM_COMMUNITY_FIELD_CONTAIN_OUT_OF_RANGE', $field['name'], $params->get('max_char'), $params->get('min_char'));
}
return JText::sprintf('COM_COMMUNITY_FIELD_CONTAIN_IMPROPER_VALUES', JText::_($field['name']));
}
开发者ID:joshjim27,项目名称:jobsglobal,代码行数:8,代码来源:profilefield.php
示例7: getFieldHTML
public function getFieldHTML($field, $required)
{
$params = new CParameter($field->params);
$readonly = $params->get('readonly') && !COwnerHelper::isCommunityAdmin() ? ' readonly=""' : '';
$style = $this->getStyle() ? ' style="' . $this->getStyle() . '"' : '';
$required = $field->required == 1 ? ' data-required="true"' : '';
// If maximum is not set, we define it to a default
$field->max = empty($field->max) ? 200 : $field->max;
$html = '<input type="text" value="' . $field->value . '" id="field' . $field->id . '" name="field' . $field->id . '" maxlength="' . $field->max . '" class="joms-input" ' . $readonly . $required . $style . ' />';
return $html;
}
开发者ID:joshjim27,项目名称:jobsglobal,代码行数:11,代码来源:text.php
示例8: getConfiguration
public static function getConfiguration()
{
static $configuration = null;
if (is_null($configuration)) {
$plugin = JPluginHelper::getPlugin('community', 'twitter');
$params = new CParameter($plugin->params);
$my = CFactory::getUser();
$oauth = JTable::getInstance('Oauth', 'CTable');
$loaded = $oauth->load($my->id, 'twitter');
$accesstoken = unserialize($oauth->accesstoken);
$configuration = array('consumer_key' => $params->get('consumerKey', '0rSLnHLm1cpX1sTsqkQaQ'), 'consumer_secret' => $params->get('consumerSecret', 'nsCObKFeJFP9YYGOZoHAHAWfvjZIZ4Hv7M8Y1w1flQ'), 'user_token' => $accesstoken['user_token'], 'user_secret' => $accesstoken['user_secret'], 'curl_ssl_verifypeer' => false);
}
return $configuration;
}
开发者ID:joshjim27,项目名称:jobsglobal,代码行数:14,代码来源:twitter.php
示例9: onGroupJoin
public function onGroupJoin($group, $userId)
{
//@rule: Clear existing invites fromt he invitation table once the user joined the group
$groupInvite = JTable::getInstance('GroupInvite', 'CTable');
$keys = array('groupid' => $group->id, 'userid' => $userId);
if ($groupInvite->load($keys)) {
$groupInvite->delete();
}
$member = JTable::getInstance('GroupMembers', 'CTable');
$keys = array('memberId' => $userId, 'groupId' => $group->id);
$member->load($keys);
$groupModel = CFactory::getModel('groups');
$admins = $groupModel->getAdmins($group->id, null);
$params = $group->getParams();
//@rule: Send notification when necessary
if ($params->get('joinrequestnotification') || $params->get('newmembernotification')) {
$user = CFactory::getUser($userId);
$subject = JText::sprintf('COM_COMMUNITY_GROUPS_EMAIL_NEW_MEMBER_JOINED_SUBJECT', '{user}', '{group}');
if (!$member->approved) {
$subject = JText::sprintf('COM_COMMUNITY_NEW_MEMBER_REQUESTED_TO_JOIN_GROUP_EMAIL_SUBJECT', '{user}', '{group}');
}
$params = new CParameter('');
$params->set('url', 'index.php?option=com_community&view=groups&task=viewgroup&groupid=' . $group->id);
$params->set('group', $group->name);
$params->set('group_url', 'index.php?option=com_community&view=groups&task=viewgroup&groupid=' . $group->id);
$params->set('user', $user->getDisplayName());
$params->set('user_url', 'index.php?option=com_community&view=profile&userid=' . $user->id);
$params->set('approved', $member->approved);
foreach ($admins as $admin) {
CNotificationLibrary::add('groups_member_join', $user->id, $admin->id, $subject, '', 'groups.memberjoin', $params);
}
}
}
开发者ID:joshjim27,项目名称:jobsglobal,代码行数:33,代码来源:groups.trigger.php
示例10: ajaxEmailPage
public function ajaxEmailPage($uri, $emails, $message = '')
{
$filter = JFilterInput::getInstance();
$uri = $filter->clean($uri, 'string');
$emails = $filter->clean($emails, 'string');
$message = $filter->clean($message, 'string');
$message = stripslashes($message);
$mainframe =& JFactory::getApplication();
$bookmarks = CFactory::getBookmarks($uri);
$mailqModel = CFactory::getModel('mailq');
$config = CFactory::getConfig();
$response = new JAXResponse();
if (empty($emails)) {
$content = '<div>' . JText::_('COM_COMMUNITY_SHARE_INVALID_EMAIL') . '</div>';
$actions = '<input type="button" class="button" onclick="joms.bookmarks.show(\'' . $uri . '\');" value="' . JText::_('COM_COMMUNITY_GO_BACK_BUTTON') . '"/>';
} else {
$emails = explode(',', $emails);
$errors = array();
// Add notification
CFactory::load('libraries', 'notification');
foreach ($emails as $email) {
$email = JString::trim($email);
CFactory::load('helpers', 'validate');
if (!empty($email) && CValidateHelper::email($email)) {
$params = new CParameter('');
$params->set('uri', $uri);
$params->set('message', $message);
CNotificationLibrary::add('etype_system_bookmarks_email', '', $email, JText::sprintf('COM_COMMUNITY_SHARE_EMAIL_SUBJECT', $config->get('sitename')), '', 'bookmarks', $params);
} else {
// If there is errors with email, inform the user.
$errors[] = $email;
}
}
if ($errors) {
$content = '<div>' . JText::_('COM_COMMUNITY_EMAILS_ARE_INVALID') . '</div>';
foreach ($errors as $error) {
$content .= '<div style="font-weight:700;color: red;">' . $error . '</span>';
}
$actions = '<input type="button" class="button" onclick="joms.bookmarks.show(\'' . $uri . '\');" value="' . JText::_('COM_COMMUNITY_GO_BACK_BUTTON') . '"/>';
} else {
$content = '<div>' . JText::_('COM_COMMUNITY_EMAIL_SENT_TO_RECIPIENTS') . '</div>';
$actions = '<input type="button" class="button" onclick="cWindowHide();" value="' . JText::_('COM_COMMUNITY_DONE_BUTTON') . '"/>';
}
}
$response->addAssign('cwin_logo', 'innerHTML', JText::_('COM_COMMUNITY_SHARE_THIS'));
$response->addScriptCall('cWindowAddContent', $content, $actions);
return $response->sendResponse();
}
开发者ID:Simarpreet05,项目名称:joomla,代码行数:48,代码来源:bookmarks.php
示例11: isValid
public function isValid($value, $required)
{
if ($required && empty($value) || !isset($this->fieldId)) {
return false;
}
$db =& JFactory::getDBO();
$query = 'SELECT * FROM ' . $db->nameQuote('#__community_fields') . ' WHERE ' . $db->nameQuote('id') . '=' . $db->quote($this->fieldId);
$db->setQuery($query);
$field = $db->loadAssoc();
$params = new CParameter($field['params']);
$max_range = $params->get('maxrange');
$min_range = $params->get('minrange');
$value = JFactory::getDate(strtotime($value))->toUnix();
$max_ok = true;
$min_ok = true;
//$ret = true;
if ($max_range) {
$max_range = JFactory::getDate(strtotime($max_range))->toUnix();
$max_ok = $value < $max_range;
}
if ($min_range) {
$min_range = JFactory::getDate(strtotime($min_range))->toUnix();
$min_ok = $value > $min_range;
}
return $max_ok && $min_ok ? true : false;
//return $ret;
}
开发者ID:Simarpreet05,项目名称:joomla,代码行数:27,代码来源:date.php
示例12: sendCommentNotification
public static function sendCommentNotification(CTableWall $wall, $message)
{
CFactory::load('libraries', 'notification');
$my = CFactory::getUser();
$targetUser = CFactory::getUser($wall->post_by);
$url = 'index.php?option=com_community&view=profile&userid=' . $wall->contentid;
$userParams = $targetUser->getParams();
$params = new CParameter('');
$params->set('url', $url);
$params->set('message', $message);
if ($my->id != $targetUser->id && $userParams->get('notifyWallComment')) {
CNotificationLibrary::add('etype_profile_submit_wall_comment', $my->id, $targetUser->id, JText::sprintf('PLG_WALLS_WALL_COMMENT_EMAIL_SUBJECT', $my->getDisplayName()), '', 'profile.wallcomment', $params);
return true;
}
return false;
}
开发者ID:Simarpreet05,项目名称:joomla,代码行数:16,代码来源:profile.php
示例13: getFieldHTML
public function getFieldHTML($field, $required)
{
$lists = array();
//a fix for wrong data input
$field->value = JString::trim($field->value);
if (is_array($field->value)) {
$tmplist = $field->value;
} else {
if (JString::strrpos($field->value, ',') == JString::strlen($field->value) - 1) {
$field->value = JString::substr($field->value, 0, -1);
}
$tmplist = explode(',', $field->value);
}
if ($tmplist) {
foreach ($tmplist as $value) {
$lists[] = JString::trim($value);
}
}
$html = '';
$elementSelected = 0;
$elementCnt = 0;
$cnt = 0;
$params = new CParameter($field->params);
$readonly = '';
if ($params->get('readonly') == 1) {
$readonly = ' disabled="disabled"';
}
$html .= '<div style="display:inline-block">';
if (is_array($field->options)) {
foreach ($field->options as $option) {
if (JString::trim($option) == '') {
//do not display blank options
continue;
}
$selected = in_array(JString::trim($option), $lists) ? ' checked="checked"' : '';
if (empty($selected)) {
$elementSelected++;
}
$html .= '<label class="lblradio-block">';
$html .= '<input type="checkbox" name="field' . $field->id . '[]" value="' . $option . '" class="joms-checkbox" ' . $selected . $readonly . ' style="margin: 2px 5px 0 0" />';
$html .= JText::_($option) . '</label>';
$elementCnt++;
}
}
$html .= '</div>';
return $html;
}
开发者ID:Jougito,项目名称:DynWeb,代码行数:47,代码来源:checkbox.php
示例14: ajaxEmailPage
public function ajaxEmailPage($uri, $emails, $message = '')
{
$filter = JFilterInput::getInstance();
$uri = $filter->clean($uri, 'string');
$emails = $filter->clean($emails, 'string');
$message = $filter->clean($message, 'string');
$message = stripslashes($message);
$mainframe = JFactory::getApplication();
$bookmarks = CFactory::getBookmarks($uri);
$mailqModel = CFactory::getModel('mailq');
$config = CFactory::getConfig();
$response = new JAXResponse();
$json = array();
if (empty($emails)) {
$json['error'] = JText::_('COM_COMMUNITY_SHARE_INVALID_EMAIL');
} else {
$emails = explode(',', $emails);
$errors = array();
// Add notification
//CFactory::load( 'libraries' , 'notification' );
foreach ($emails as $email) {
$email = JString::trim($email);
if (!empty($email) && CValidateHelper::email($email)) {
$params = new CParameter('');
$params->set('uri', $uri);
$params->set('message', $message);
CNotificationLibrary::add('system_bookmarks_email', '', $email, JText::sprintf('COM_COMMUNITY_SHARE_EMAIL_SUBJECT', $config->get('sitename')), '', 'bookmarks', $params);
} else {
// If there is errors with email, inform the user.
$errors[] = $email;
}
}
if ($errors) {
$content = '<div>' . JText::_('COM_COMMUNITY_EMAILS_ARE_INVALID') . '</div>';
foreach ($errors as $error) {
$content .= '<div style="font-weight:bold; color:red;">' . $error . '</div>';
}
$json['error'] = $content;
} else {
$content = JText::_('COM_COMMUNITY_EMAIL_SENT_TO_RECIPIENTS');
$json['message'] = $content;
}
}
die(json_encode($json));
}
开发者ID:Jougito,项目名称:DynWeb,代码行数:45,代码来源:bookmarks.php
示例15: getFieldHTML
public function getFieldHTML($field, $required)
{
$params = new CParameter($field->params);
$readonly = $params->get('readonly') ? ' readonly=""' : '';
$style = $this->getStyle() ? '' : ' style="' . $this->getStyle() . '" ';
// If maximum is not set, we define it to a default
$field->max = empty($field->max) ? 200 : $field->max;
CFactory::load('helpers', 'string');
$class = $field->required == 1 ? ' required' : '';
$class .= !empty($field->tips) ? ' jomNameTips tipRight' : '';
$tooltipcss = "";
if (!empty($field->tips)) {
$tooltipcss = "jomNameTips";
}
$html = '<input title="' . CStringHelper::escape(JText::_($field->tips)) . '" type="text" value="' . $field->value . '" id="field' . $field->id . '" name="field' . $field->id . '" maxlength="' . $field->max . '" size="40" class="' . $tooltipcss . ' tipRight inputbox' . $class . '" ' . $style . $readonly . ' />';
$html .= '<span id="errfield' . $field->id . 'msg" style="display:none;"> </span>';
return $html;
}
开发者ID:Simarpreet05,项目名称:joomla,代码行数:18,代码来源:text.php
示例16: getFieldHTML
public function getFieldHTML($field, $required)
{
// If maximum is not set, we define it to a default
$field->max = empty($field->max) ? 200 : $field->max;
//get the value in param
$params = new CParameter($field->params);
$style = $this->getStyle() ? '' : ' style="' . $this->getStyle() . '" ';
$class = $field->required == 1 ? ' required' : '';
$class .= $params->get('min_char') != '' && $params->get('max_char') != '' ? ' minmax_' . $params->get('min_char') . '_' . $params->get('max_char') : '';
$class .= !empty($field->tips) ? ' jomNameTips tipRight' : '';
CFactory::load('helpers', 'string');
ob_start();
?>
<input class="inputbox validate-profile-email<?php
echo $class;
?>
" title="<?php
echo CStringHelper::escape(JText::_($field->tips));
?>
" type="text" value="<?php
echo $field->value;
?>
" id="field<?php
echo $field->id;
?>
" name="field<?php
echo $field->id;
?>
" maxlength="<?php
echo $field->max;
?>
" size="40" <?php
echo $style;
?>
/>
<span id="errfield<?php
echo $field->id;
?>
msg" style="display:none;"> </span>
<?php
$html = ob_get_contents();
ob_end_clean();
return $html;
}
开发者ID:Simarpreet05,项目名称:joomla,代码行数:44,代码来源:email.php
示例17: getFieldHTML
public function getFieldHTML($field, $required)
{
$params = new CParameter($field->params);
$readonly = $params->get('readonly') ? ' readonly=""' : '';
$style = $this->getStyle() ? '' : ' style="' . $this->getStyle() . '" ';
$config = CFactory::getConfig();
$js = 'assets/validate-1.5';
$js .= $config->getBool('usepackedjavascript') ? '.pack.js' : '.js';
CAssets::attach($js, 'js');
// If maximum is not set, we define it to a default
$field->max = empty($field->max) ? 200 : $field->max;
$class = $field->required == 1 ? ' required' : '';
$class .= !empty($field->tips) ? ' jomNameTips tipRight' : '';
CFactory::load('helpers', 'string');
$html = '<textarea id="field' . $field->id . '" name="field' . $field->id . '" class="inputbox textarea' . $class . '" title="' . CStringHelper::escape(JText::_($field->tips)) . '"' . $style . $readonly . '>' . $field->value . '</textarea>';
$html .= '<span id="errfield' . $field->id . 'msg" style="display:none;"> </span>';
$html .= '<script type="text/javascript">cvalidate.setMaxLength("#field' . $field->id . '", "' . $field->max . '");</script>';
return $html;
}
开发者ID:Simarpreet05,项目名称:joomla,代码行数:19,代码来源:textarea.php
示例18: ajaxTogglePublish
public function ajaxTogglePublish($id, $type)
{
// Send email notification to owner when a group is published.
$config =& CFactory::getConfig();
$group =& JTable::getInstance('Group', 'CTable');
$group->load($id);
if ($type == 'published' && $group->published == 0 && $config->get('moderategroupcreation')) {
$lang =& JFactory::getLanguage();
$lang->load('com_community', JPATH_ROOT);
$my =& CFactory::getUser();
// Add notification
CFactory::load('libraries', 'notification');
//Send notification email to owner
$params = new CParameter('');
$params->set('url', 'index.php?option=com_community&view=groups&task=viewgroup&groupid=' . $group->id);
$params->set('groupName', $group->name);
CNotificationLibrary::add('etype_groups_notify_creator', $my->id, $group->ownerid, JText::sprintf('COM_COMMUNITY_GROUPS_PUBLISHED_MAIL_SUBJECT', $group->name), '', 'groups.notifycreator', $params);
}
return parent::ajaxTogglePublish($id, $type, 'groups');
}
开发者ID:Simarpreet05,项目名称:joomla,代码行数:20,代码来源:groups.php
示例19: getFieldData
public function getFieldData($field)
{
$value = $field['value'];
if (empty($value)) {
return $value;
}
$params = new CParameter($field['params']);
$format = $params->get('display');
if (!class_exists('CFactory')) {
require_once JPATH_ROOT . DS . 'components' . DS . 'com_community' . DS . 'libraries' . DS . 'core.php';
}
$ret = '';
if ($format == 'age') {
// PHP version > 5.2
$datetime = new DateTime($value);
$now = new DateTime('now');
// PHP version > 5.3
if (method_exists($datetime, 'diff')) {
$interval = $datetime->diff($now);
$ret = $interval->format('%Y');
} else {
$mth = $now->format('m') - $datetime->format('m');
$day = $now->format('d') - $datetime->format('d');
$ret = $now->format('Y') - $datetime->format('Y');
if ($mth >= 0) {
if ($day < 0 && $mth == 0) {
$ret--;
}
} else {
$ret--;
}
}
} else {
require_once JPATH_ROOT . DS . 'components' . DS . 'com_community' . DS . 'models' . DS . 'profile.php';
$model = CFactory::getModel('profile');
//overwrite Profile date format in Configuration
$format = $params->get('date_format');
$ret = $model->formatDate($value, $format);
}
return $ret;
}
开发者ID:Simarpreet05,项目名称:joomla,代码行数:41,代码来源:birthdate.php
示例20: onEventCreate
public function onEventCreate($event)
{
$config = CFactory::getConfig();
// Send an email notification to the site admin's when there is a new group created
if ($config->get('event_moderation')) {
$userModel = CFactory::getModel('User');
$my = CFactory::getUser();
$admins = $userModel->getSuperAdmins();
// Add notification
CFactory::load('libraries', 'notification');
//Send notification email to administrators
foreach ($admins as $row) {
if ($row->sendEmail) {
$params = new CParameter('');
$params->set('url', JURI::root() . 'administrator/index.php?option=com_community&view=events');
$params->set('title', $event->title);
CNotificationLibrary::add('etype_events_notify_admin', $my->id, $row->id, JText::sprintf('COM_COMMUNITY_EVENTS_MODERATION_NOTICE', $event->title), '', 'events.notifyadmin', $params);
}
}
}
}
开发者ID:Simarpreet05,项目名称:joomla,代码行数:21,代码来源:events.trigger.php
注:本文中的CParameter类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论