本文整理汇总了PHP中flexicontent_html::stateicon方法的典型用法代码示例。如果您正苦于以下问题:PHP flexicontent_html::stateicon方法的具体用法?PHP flexicontent_html::stateicon怎么用?PHP flexicontent_html::stateicon使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类flexicontent_html
的用法示例。
在下文中一共展示了flexicontent_html::stateicon方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: isset
if ($fieldname == 'catid') {
echo $field_values . ' : ';
echo isset($this->categories[$field_values]) ? $this->categories[$field_values]->title : 'Invalid, no Category with ID: ' . $field_values;
} else {
if ($fieldname == 'cid') {
$seccats = array();
foreach ($field_values as $seccatid) {
$seccats[] = isset($this->categories[$seccatid]) ? $this->categories[$seccatid]->title : 'Invalid, no Category with ID: ' . $seccatid;
}
echo !empty($seccats) ? implode(", ", $seccats) : '-';
} else {
if ($fieldname == 'language') {
echo $this->languages->{$field_values}->name;
} else {
if ($fieldname == 'state') {
echo flexicontent_html::stateicon($field_values, $this->cparams);
} else {
if (!is_array($field_values)) {
$is_missing = !empty($this->conf['filenames_missing'][$fieldname]) && is_string($field_values) && isset($this->conf['filenames_missing'][$fieldname][$field_values]);
echo $is_missing ? '<span class="fcimport_missingfile hasTip" title="File is missing::not found in path ' . @$this->conf['thefields'][$fieldname]->folderpath . '">' : '';
echo mb_strlen($field_values, 'UTF-8') > 40 ? mb_substr(strip_tags($field_values), 0, 40, 'UTF-8') . ' ... ' : $field_values;
echo $is_missing ? '</span>' : '';
} else {
echo '<ul class="fcimport_field_value_list">';
foreach ($field_values as $field_value) {
echo '<li>';
if (!is_array($field_value)) {
$is_missing = !empty($this->conf['filenames_missing'][$fieldname]) && is_string($field_value) && isset($this->conf['filenames_missing'][$fieldname][$field_value]);
echo $is_missing ? '<span class="fcimport_missingfile hasTip" title="File is missing::not found in path ' . @$this->conf['thefields'][$fieldname]->folderpath . '">' : '';
echo mb_strlen($field_value, 'UTF-8') > 40 ? mb_substr(strip_tags($field_value), 0, 40, 'UTF-8') . ' ... ' : $field_value;
echo $is_missing ? '</span>' : '';
示例2: onDisplayCoreFieldValue
//.........这里部分代码省略.........
$ogpinview = $field->parameters->get('ogpinview', array());
$ogpinview = FLEXIUtilities::paramToArray($ogpinview);
$ogpmaxlen = $field->parameters->get('ogpmaxlen', 300);
if ($useogp && $field->{$prop}) {
if (in_array($view, $ogpinview)) {
$content_val = flexicontent_html::striptagsandcut($field->{$prop}, $ogpmaxlen);
JFactory::getDocument()->addCustomTag('<meta property="og:title" content="' . $content_val . '" />');
}
}
// Add microdata property (currently no parameter in XML for this field)
$itemprop = $field->parameters->get('microdata_itemprop', 'name');
if ($itemprop) {
$field->{$prop} = '<div style="display:inline" itemprop="' . $itemprop . '" >' . $field->{$prop} . '</div>';
}
break;
case 'hits':
// hits
$field->value[] = $item->hits;
$field->{$prop} = $pretext . $item->hits . $posttext;
break;
case 'type':
// document type
$field->value[] = $item->type_id;
$field->{$prop} = $pretext . JText::_($item->typename) . $posttext;
break;
case 'version':
// version
$field->value[] = $item->version;
$field->{$prop} = $pretext . $item->version . $posttext;
break;
case 'state':
// state
$field->value[] = $item->state;
$field->{$prop} = $pretext . flexicontent_html::stateicon($item->state, $field->parameters) . $posttext;
break;
case 'voting':
// voting button
if ($_vote === false) {
$vote =& $item->vote;
} else {
$vote =& $_vote;
}
$field->value[] = 'button';
// dummy value to force display
$field->{$prop} = $pretext . flexicontent_html::ItemVote($field, 'all', $vote) . $posttext;
break;
case 'favourites':
// favourites button
if ($_favourites === false) {
$favourites =& $item->favs;
} else {
$favourites =& $_favourites;
}
if ($_favoured === false) {
$favoured =& $item->fav;
} else {
$favoured =& $_favoured;
}
$field->value[] = 'button';
// dummy value to force display
$favs = flexicontent_html::favoured_userlist($field, $item, $favourites);
$field->{$prop} = $pretext . '
<div class="fav-block">
' . flexicontent_html::favicon($field, $favoured, $item) . '
<div id="fcfav-reponse_item_' . $item->id . '" class="fcfav-reponse-tip">
<div class="fc-mssg-inline fc-info fc-iblock fc-nobgimage ' . ($favoured ? 'fcfavs-is-subscriber' : 'fcfavs-isnot-subscriber') . '">
示例3: statebutton
/**
* Creates the state selector button
*
* @param int $id
* @param array $params
* @since 1.0
*/
static function statebutton($item, &$params = null, $addToggler = true)
{
// Check for empty params too
if ($params && !$params->get('show_state_icon', 1) || JRequest::getCmd('print')) {
return;
}
$user = JFactory::getUser();
$db = JFactory::getDBO();
$document = JFactory::getDocument();
$nullDate = $db->getNullDate();
$app = JFactory::getApplication();
// Determine general archive privilege
static $has_archive = null;
if ($has_archive === null) {
$permission = FlexicontentHelperPerm::getPerm();
$has_archive = $permission->CanArchives;
}
// Determine edit state, delete privileges of the current user on the given item
$asset = 'com_content.article.' . $item->id;
$has_edit_state = $user->authorise('core.edit.state', $asset) || $user->authorise('core.edit.state.own', $asset) && $item->created_by == $user->get('id');
$has_delete = $user->authorise('core.delete', $asset) || $user->authorise('core.delete.own', $asset) && $item->created_by == $user->get('id');
// Display state toggler if it can do any of state change
$canChangeState = $has_edit_state || $has_delete || $has_archive;
static $js_and_css_added = false;
if (!$js_and_css_added && $canChangeState && $addToggler) {
// File exists both in frontend & backend (and is different), so we will use 'base' method and not 'root'
$document->addScriptVersion(JURI::root(true) . '/components/com_flexicontent/assets/js/stateselector.js', FLEXI_VERSION);
$js = '
function fc_setitemstate(state, id)
{
var handler = new fc_statehandler({task: "' . ($app->isAdmin() ? 'items.setitemstate' : 'setitemstate') . '"});
handler.setstate( state, id );
}';
$document->addScriptDeclaration($js);
$js_and_css_added = true;
}
static $state_names = null;
static $state_descrs = null;
static $state_imgs = null;
static $tooltip_class = null;
static $state_tips = null;
static $button_classes = null;
static $icon_sep = null;
if (!$state_names) {
$state_names = array(1 => JText::_('FLEXI_PUBLISHED'), -5 => JText::_('FLEXI_IN_PROGRESS'), 0 => JText::_('FLEXI_UNPUBLISHED'), -3 => JText::_('FLEXI_PENDING'), -4 => JText::_('FLEXI_TO_WRITE'), 2 => JText::_('FLEXI_ARCHIVED'), -2 => JText::_('FLEXI_TRASHED'), '' => JText::_('FLEXI_UNKNOWN'));
$state_descrs = array(1 => JText::_('FLEXI_PUBLISH_THIS_ITEM'), -5 => JText::_('FLEXI_SET_STATE_AS_IN_PROGRESS'), 0 => JText::_('FLEXI_UNPUBLISH_THIS_ITEM'), -3 => JText::_('FLEXI_SET_STATE_AS_PENDING'), -4 => JText::_('FLEXI_SET_STATE_AS_TO_WRITE'), 2 => JText::_('FLEXI_ARCHIVE_THIS_ITEM'), -2 => JText::_('FLEXI_TRASH_THIS_ITEM'), '' => 'FLEXI_UNKNOWN');
$state_imgs = array(1 => 'tick.png', -5 => 'publish_g.png', 0 => 'publish_x.png', -3 => 'publish_r.png', -4 => 'publish_y.png', 2 => 'archive.png', -2 => 'trash.png', '' => 'unknown.png');
$tooltip_class = FLEXI_J30GE ? ' hasTooltip' : ' hasTip';
$state_tips = array();
$title_header = '';
//JText::_( 'FLEXI_ACTION' );
foreach ($state_names as $state_id => $i) {
$state_tips[$state_id] = flexicontent_html::getToolTip($title_header, $state_names[$state_id], 0);
}
$button_classes = 'fc_statebutton';
$button_classes .= FLEXI_J30GE ? ' btn btn-small' : ' fc_button fcsimple fcsmall';
$button_classes .= FLEXI_J30GE ? ' hasTooltip' : ' hasTip';
$icon_sep = JText::_('FLEXI_ICON_SEP');
}
// Create state icon
$state = $item->state;
$state_text = '';
$tmpparams = new JRegistry();
$tmpparams->set('stateicon_popup', 'none');
$stateicon = flexicontent_html::stateicon($state, $tmpparams, $state_text);
$tz_string = JFactory::getApplication()->getCfg('offset');
$tz = new DateTimeZone($tz_string);
$tz_offset = $tz->getOffset(new JDate()) / 3600;
// Calculate common variables used to produce output
$publish_up = JFactory::getDate($item->publish_up);
$publish_down = JFactory::getDate($item->publish_down);
$publish_up->setTimezone($tz);
$publish_down->setTimezone($tz);
$img_path = JURI::root(true) . "/components/com_flexicontent/assets/images/";
// Create publish information
$publish_info = '';
if (isset($item->publish_up)) {
if ($item->publish_up == $nullDate) {
$publish_info .= JText::_('FLEXI_START_ALWAYS');
} else {
$publish_info .= JText::_('FLEXI_START') . ": " . JHTML::_('date', $publish_up->toSql(), 'Y-m-d H:i:s');
}
}
if (isset($item->publish_down)) {
if ($item->publish_down == $nullDate) {
$publish_info .= ($publish_info ? '<br/>' : '') . JText::_('FLEXI_FINISH_NO_EXPIRY');
} else {
$publish_info .= ($publish_info ? '<br/>' : '') . JText::_('FLEXI_FINISH') . ": " . JHTML::_('date', $publish_down->toSql(), 'Y-m-d H:i:s');
}
}
$publish_info = $state_text . '<br/>' . $publish_info;
// Create the state selector button and return it
if ($canChangeState && $addToggler) {
//.........这里部分代码省略.........
示例4: onDisplayCoreFieldValue
//.........这里部分代码省略.........
// title
$field->value[] = $item->title;
$field->display = $pretext . $item->title . $posttext;
// Get ogp configuration
$useogp = $field->parameters->get('useogp', 1);
$ogpinview = $field->parameters->get('ogpinview', array());
$ogpinview = FLEXIUtilities::paramToArray($ogpinview);
$ogpmaxlen = $field->parameters->get('ogpmaxlen', 300);
if ($useogp && $field->{$prop}) {
if (in_array($view, $ogpinview)) {
$content_val = flexicontent_html::striptagsandcut($field->display, $ogpmaxlen);
JFactory::getDocument()->addCustomTag('<meta property="og:title" content="' . $content_val . '" />');
}
}
break;
case 'hits':
// hits
$field->value[] = $item->hits;
$field->display = $pretext . $item->hits . $posttext;
break;
case 'type':
// document type
$field->value[] = $item->type_id;
$field->display = $pretext . JText::_($item->typename) . $posttext;
break;
case 'version':
// version
$field->value[] = $item->version;
$field->display = $pretext . $item->version . $posttext;
break;
case 'state':
// state
$field->value[] = $item->state;
$field->display = $pretext . flexicontent_html::stateicon($item->state, $field->parameters) . $posttext;
break;
case 'voting':
// voting button
if ($_vote === false) {
$vote =& $item->vote;
} else {
$vote =& $_vote;
}
$field->value[] = 'button';
// dummy value to force display
$field->display = $pretext . flexicontent_html::ItemVote($field, 'all', $vote) . $posttext;
break;
case 'favourites':
// favourites button
if ($_favourites === false) {
$favourites =& $item->favs;
} else {
$favourites =& $_favourites;
}
if ($_favoured === false) {
$favoured =& $item->fav;
} else {
$favoured =& $_favoured;
}
$field->value[] = 'button';
// dummy value to force display
$favs = flexicontent_html::favoured_userlist($field, $item, $favourites);
$field->display = $pretext . '
<span class="fav-block">
' . flexicontent_html::favicon($field, $favoured, $item) . '
<span id="fcfav-reponse_' . $field->item_id . '" class="fcfav-reponse">
<small>' . $favs . '</small>
示例5: statebutton
/**
* Creates the state selector button
*
* @param int $id
* @param array $params
* @since 1.0
*/
static function statebutton( $item, &$params=null, $addToggler=true )
{
// Check for empty params too
if ( $params && !$params->get('show_state_icon', 1) || JRequest::getCmd('print') ) return;
$user = JFactory::getUser();
$db = JFactory::getDBO();
$document = JFactory::getDocument();
$nullDate = $db->getNullDate();
$app = JFactory::getApplication();
// Determine general archive privilege
static $has_archive = null;
if ($has_archive === null) {
$permission = FlexicontentHelperPerm::getPerm();
$has_archive = $permission->CanArchives;
}
// Determine edit state, delete privileges of the current user on the given item
if (FLEXI_J16GE) {
$asset = 'com_content.article.' . $item->id;
$has_edit_state = $user->authorise('core.edit.state', $asset) || ($user->authorise('core.edit.state.own', $asset) && $item->created_by == $user->get('id'));
$has_delete = $user->authorise('core.delete', $asset) || ($user->authorise('core.delete.own', $asset) && $item->created_by == $user->get('id'));
} else if ($user->gid >= 25) {
$has_edit_state = true;
$has_delete = true;
} else if (FLEXI_ACCESS) {
$rights = FAccess::checkAllItemAccess('com_content', 'users', $user->gmid, $item->id, $item->catid);
$has_edit_state = in_array('publish', $rights) || (in_array('publishown', $rights) && $item->created_by == $user->get('id')) ;
$has_delete = in_array('delete', $rights) || (in_array('deleteown', $rights) && $item->created_by == $user->get('id')) ;
} else {
$has_edit_state = $user->authorize('com_content', 'publish', 'content', 'all');
$has_delete = $user->gid >= 23; // is at least manager
}
// Display state toggler if it can do any of state change
$canChangeState = $has_edit_state || $has_delete || $has_archive;
static $js_and_css_added = false;
if (!$js_and_css_added && $canChangeState && $addToggler )
{
// File exists both in frontend & backend (and is different), so we will use 'base' method and not 'root'
$document->addScript( JURI::base(true).'/components/com_flexicontent/assets/js/stateselector.js' );
$js ='
if(MooTools.version>="1.2.4") {
window.addEvent("domready", function() {stateselector.init()});
}else{
window.onDomReady(stateselector.init.bind(stateselector));
}
function dostate(state, id)
{
var change = new processstate();
change.dostate( state, id );
}';
$document->addScriptDeclaration($js);
$js_and_css_added = true;
}
static $state_names = null;
static $state_descrs = null;
static $state_imgs = null;
if ( !$state_names ) {
$state_names = array(1=>JText::_('FLEXI_PUBLISHED'), -5=>JText::_('FLEXI_IN_PROGRESS'), 0=>JText::_('FLEXI_UNPUBLISHED'), -3=>JText::_('FLEXI_PENDING'), -4=>JText::_('FLEXI_TO_WRITE'), (FLEXI_J16GE ? 2:-1)=>JText::_('FLEXI_ARCHIVED'), -2=>JText::_('FLEXI_TRASHED'), ''=>'FLEXI_UNKNOWN');
$state_descrs = array(1=>JText::_('FLEXI_PUBLISH_THIS_ITEM'), -5=>JText::_('FLEXI_SET_ITEM_IN_PROGRESS'), 0=>JText::_('FLEXI_UNPUBLISH_THIS_ITEM'), -3=>JText::_('FLEXI_SET_ITEM_PENDING'), -4=>JText::_('FLEXI_SET_ITEM_TO_WRITE'), (FLEXI_J16GE ? 2:-1)=>JText::_('FLEXI_ARCHIVE_THIS_ITEM'), -2=>JText::_('FLEXI_TRASH_THIS_ITEM'), ''=>'FLEXI_UNKNOWN');
$state_imgs = array(1=>'tick.png', -5=>'publish_g.png', 0=>'publish_x.png', -3=>'publish_r.png', -4=>'publish_y.png', (FLEXI_J16GE ? 2:-1)=>'archive.png', -2=>'trash.png', ''=>'unknown.png');
}
// Create state icon
$state = $item->state;
$state_text ='';
$tmpparams = FLEXI_J16GE ? new JRegistry() : new JParameter("");
$tmpparams->set('stateicon_popup', 'none');
$stateicon = flexicontent_html::stateicon( $state, $tmpparams, $state_text );
$tz_string = JFactory::getApplication()->getCfg('offset');
if (FLEXI_J16GE) {
$tz = new DateTimeZone( $tz_string );
$tz_offset = $tz->getOffset(new JDate()) / 3600;
} else {
$tz_offset = $tz_string;
}
// Calculate common variables used to produce output
$publish_up = JFactory::getDate($item->publish_up);
$publish_down = JFactory::getDate($item->publish_down);
if (FLEXI_J16GE) {
$publish_up->setTimezone($tz);
$publish_down->setTimezone($tz);
} else {
$publish_up->setOffset($tz_offset);
$publish_down->setOffset($tz_offset);
//.........这里部分代码省略.........