本文整理匯總了PHP中FabrikHelperHTML::addStyleDeclaration方法的典型用法代碼示例。如果您正苦於以下問題:PHP FabrikHelperHTML::addStyleDeclaration方法的具體用法?PHP FabrikHelperHTML::addStyleDeclaration怎麽用?PHP FabrikHelperHTML::addStyleDeclaration使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類FabrikHelperHTML
的用法示例。
在下文中一共展示了FabrikHelperHTML::addStyleDeclaration方法的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: render
/**
* draws the form element
* @param int repeat group counter
* @return string returns element html
*/
function render($data, $repeatCounter = 0)
{
$name = $this->getHTMLName($repeatCounter);
$id = $this->getHTMLId($repeatCounter);
$element = $this->getElement();
$params =& $this->getParams();
$arVals = $this->getSubOptionValues();
$arTxt = $this->getSubOptionLabels();
$arSelected = (array) $this->getValue($data, $repeatCounter);
$errorCSS = isset($this->_elementError) && $this->_elementError != '' ? " elementErrorHighlight" : '';
$attribs = 'class="picklistcontainer' . $errorCSS . "\"";
$style = ".frompicklist, .topicklist{\n" . "background-color:#efefef;\n" . "padding:5px !important;\n" . "}\n" . "\n" . "div.picklistcontainer{\n" . "width:40%;\n" . "margin-right:10px;\n" . "margin-bottom:10px;\n" . "float:left;\n" . "}\n" . "\n" . ".frompicklist li, .topicklist li, li.picklist{\n" . "background-color:#FFFFFF;\n" . "margin:3px;\n" . "padding:5px !important;\n" . "cursor:move;\n" . "}\n" . "\n" . "li.emptyplicklist{\n" . "background-color:transparent;\n" . "cursor:pointer;\n" . "}";
FabrikHelperHTML::addStyleDeclaration($style);
$i = 0;
$aRoValues = array();
$fromlist = "from:<ul id=\"{$id}" . "_fromlist\" class=\"frompicklist\">\n";
$tolist = "to:<ul id=\"{$id}" . "_tolist\" class=\"topicklist\">\n";
foreach ($arVals as $v) {
//$tmptxt = addslashes(htmlspecialchars($arTxt[$i]));
if (!in_array($v, $arSelected)) {
$fromlist .= "<li id=\"{$id}_value_{$v}\" class=\"picklist\">" . $arTxt[$i] . "</li>\n";
}
$i++;
}
$i = 0;
$lookup = array_flip($arVals);
foreach ($arSelected as $v) {
if ($v == '' || $v == '-') {
continue;
}
$k = JArrayHelper::getValue($lookup, $v);
$tmptxt = addslashes(htmlspecialchars(JArrayHelper::getValue($arTxt, $k)));
$tolist .= "<li id=\"{$id}_value_{$v}\" class=\"{$v}\">" . $tmptxt . "</li>\n";
$aRoValues[] = $tmptxt;
$i++;
}
if (empty($arSelected)) {
$fromlist .= "<li class=\"emptyplicklist\">" . JText::_('PLG_ELEMENT_PICKLIST_DRAG_OPTIONS_HERE') . "</li>\n";
}
if (empty($aRoValues)) {
$tolist .= "<li class=\"emptyplicklist\">" . JText::_('PLG_ELEMENT_PICKLIST_DRAG_OPTIONS_HERE') . "</li>\n";
}
$fromlist .= "</ul>\n";
$tolist .= "</ul>\n";
$str = "<div {$attribs}>{$fromlist}</div><div class='picklistcontainer'>{$tolist}</div>";
$str .= $this->getHiddenField($name, json_encode($arSelected), $id);
if (!$this->_editable) {
return implode(', ', $aRoValues);
}
if ($params->get('allowadd', false)) {
$onlylabel = $params->get('allowadd-onlylabel');
$str .= $this->getAddOptionFields($onlylabel, $repeatCounter);
}
return $str;
}
示例2: onMakeFilters
/**
* called when the table filters are loaded
* appends the widget html to the filters
*/
function onMakeFilters(&$params, &$model)
{
if (!is_object($this->getMapElement())) {
return;
}
$app =& JFactory::getApplication();
$baseContext = $this->getSessionContext();
$this->model =& $model;
$f = new stdClass();
$f->label = $params->get('radius_label', 'Radius search');
$class = "class=\"inputbox fabrik_filter autocomplete-trigger\"";
$type = $app->getUserStateFromRequest($baseContext . 'radius_search_type', 'radius_search_type', array('mylocation'));
$style = $type[0] == 'place' ? 'display:block' : 'display:none';
$placeElement =& $this->getPlaceElement()->getElement();
$context = $baseContext . 'radius_search_place-auto-complete';
$name = "radius_search_place{$this->_counter}-auto-complete";
$place = $app->getUserStateFromRequest($context, $name);
$strPlace = "<div class=\"radius_search_place_container\" style=\"{$style};position:relative;\">\r\n\t\t<input name=\"{$name}\" id=\"{$name}\" {$class} value=\"{$place}\"/>";
$context = $baseContext . 'radius_search_place';
$name = 'radius_search_place';
$placeValue = $app->getUserStateFromRequest($context, $name);
$strPlace .= "\r\n\t\t<input type=\"hidden\" name=\"{$name}\" id=\"{$name}{$this->_counter}\" {$class} value=\"{$placeValue}\"/>\r\n\t\t</div>";
$style = $type[0] == 'latlon' ? 'display:block' : 'display:none';
$lat = $app->getUserStateFromRequest($baseContext . 'lat', 'radius_search_lat');
$lon = $app->getUserStateFromRequest($baseContext . 'lon', 'radius_search_lon');
$strLatLon = "<div class=\"radius_search_coords_container\" style=\"{$style}\">\r\n\t\t<table><tr><td><label for=\"radius_search_lat\">" . JText::_('PLG_VIEW_RADIUS_LATITUDE') . "</label></td><td><input name=\"radius_search_lat\" value=\"{$lat}\" id=\"radius_search_lat\" {$class} size=\"6\"/></td></tr>\r\n\t\t<label><tr><td><label for=\"radius_search_lon\">" . JText::_('PLG_VIEW_RADIUS_LONGITUDE') . "</label></td><td><input name=\"radius_search_lon\" value=\"{$lon}\" id=\"radius_search_lon\" {$class} size=\"6\"/></td></tr></table></div>";
$strSlider = $this->slider();
$checked = $type[0] == 'mylocation' ? 'checked="checked"' : '';
$options = "<label>" . JText::_('PLG_VIEW_RADIUS_MY_LOCATION') . "<input type=\"radio\" name=\"radius_search_type[]\" value=\"mylocation\" {$checked} /></label><br />";
$checked = $type[0] == 'place' ? 'checked="checked"' : '';
$options .= "<label>" . strip_tags($placeElement->label) . "<input type=\"radio\" name=\"radius_search_type[]\" value=\"place\" {$checked} /></label><br />";
$checked = $type[0] == 'latlon' ? 'checked="checked"' : '';
$options .= "<label>" . JText::_('PLG_VIEW_RADIUS_COORDINATES') . "<input type=\"radio\" name=\"radius_search_type[]\" value=\"latlon\" {$checked} /></label><br />";
$active = $app->getUserStateFromRequest($baseContext . 'radius_serach_active', 'radius_search_active');
if ($active[0] == 1) {
$yessel = "checked=\"checked\"";
$nosel = "";
} else {
$yessel = "";
$nosel = "checked=\"checked\"";
}
$str = "<div class=\"radus_search\">\r\n\r\n\t\t<label>" . JText::_('PLG_VIEW_RADIUS_ACTIVE') . "<input type=\"radio\" {$yessel} name=\"radius_search_active[]\" value=\"1\" /></label>\r\n\t\t<label>" . JText::_('PLG_VIEW_RADIUS_INACTIVE') . "<input type=\"radio\" {$nosel} name=\"radius_search_active[]\" value=\"0\" /></label>\r\n\t\t<div class=\"radius_search_options\">\r\n\t\t<table class=\"radius_table\" style=\"width:100%\">\r\n\t\t\t<tr>\r\n\t\t\t\t<td>" . JText::_('PLG_VIEW_RADIUS_DISTANCE') . "</td>\r\n\t\t\t\t<td>{$strSlider}</td>\r\n\t\t\t<tr>\r\n\t\t\t\t<td>" . JText::_('PLG_VIEW_RADIUS_FROM') . ":<br />{$options}</td>\r\n\t\t\t\t<td style=\"text-align:left\">{$strPlace} {$strLatLon}\r\n\t\t\t</tr>\r\n\t\t</table>\r\n\t\t</div>\r\n\t\t";
$str .= "</div>";
$f->element = $str;
$f->required = '';
FabrikHelperHTML::addStyleDeclaration("table.radius_table{border-collapse:collapse;border:0;}\r\n\t\ttable.radius_table td{border:0;}");
$model->viewfilters[] = $f;
}
示例3: onLoadJavascriptInstance
/**
* return the javascript to create an instance of the class defined in formJavascriptClass
* @param object parameters
* @param list table model
* @param array [0] => string table's form id to contain plugin
* @return bool
*/
function onLoadJavascriptInstance($params, $model, $args)
{
parent::onLoadJavascriptInstance($params, $model, $args);
FabrikHelperHTML::addStyleDeclaration('.focusClass{border:1px solid red !important;}');
FabrikHelperHTML::script('media/com_fabrik/js/element.js');
$listModel = JModel::getInstance('list', 'FabrikFEModel');
$listModel->setId(JRequest::getVar('listid'));
$elements = $model->getElements('filtername');
$pels = $params->get('inline_editable_elements');
$use = trim($pels) == '' ? array() : explode(",", $pels);
$els = array();
$srcs = array();
foreach ($elements as $key => $val) {
$key = FabrikString::safeColNameToArrayKey($key);
if (empty($use) || in_array($key, $use)) {
$els[$key] = new stdClass();
$els[$key]->elid = $val->_id;
$els[$key]->plugin = $val->getElement()->plugin;
//load in all element js classes
$val->formJavascriptClass($src);
}
}
FabrikHelperHTML::script($srcs, true);
$opts = new stdClass();
$opts->elements = $els;
$opts->listid = $model->getId();
$opts->focusClass = 'focusClass';
$opts->editEvent = $params->get('inline_edit_event', 'dblclick');
$opts->tabSave = $params->get('inline_tab_save', false);
$opts->showCancel = $params->get('inline_show_cancel', true);
$opts->showSave = $params->get('inline_show_save', true);
$opts->loadFirst = (bool)$params->get('inline_load_first', false);
$opts = json_encode($opts);
$formid = 'list_'+$model->getFormModel()->getForm()->id;
$this->jsInstance = "new FbListInlineEdit($opts)";
return true;
}
示例4: onMakeFilters
/**
* Build the radius search HTML
*
* @param array &$args Plugin args
*
* @return void
*/
public function onMakeFilters(&$args)
{
if (!is_object($this->getMapElement())) {
return;
}
$model = $this->getModel();
$params = $this->getParams();
$f = new stdClass();
$f->label = FText::_($params->get('radius_label', 'Radius search'));
FabrikHelperHTML::stylesheet('plugins/fabrik_list/radius_search/radius_search.css');
$layoutData = new stdClass();
$layoutData->renderOrder = $this->renderOrder;
$layoutData->baseContext = $this->getSessionContext();
$layoutData->defaultSearch = $params->get('default_search', 'mylocation');
$layoutData->geocodeDefault = $params->get('geocode_default', '');
$layoutData->unit = $this->getParams()->get('radius_unit', 'km');
$layoutData->distance = $this->getValue();
$layoutData->startActive = $params->get('start_active', 0);
$typeKey = $layoutData->baseContext . 'radius_search_type' . $this->renderOrder;
$type = $this->app->getUserStateFromRequest($typeKey, 'radius_search_type' . $this->renderOrder, array($layoutData->defaultSearch));
$layoutData->select = $this->searchSelectList($type);
$layoutData->type = $type[0];
list($layoutData->searchLatitude, $layoutData->searchLongitude) = $this->getSearchLatLon();
$layoutData->geocodeAsYouType = $params->get('geocode_as_type', 1);
$layoutData->hasGeocode = $params->get('geocode', 1) == 1;
$layoutData->address = $address = $this->app->getUserStateFromRequest($layoutData->baseContext . 'geocode' . $this->renderOrder, 'radius_search_geocode_field' . $this->renderOrder);
$lat = $this->app->getUserStateFromRequest($layoutData->baseContext . 'lat' . $this->renderOrder, 'radius_search_lat' . $this->renderOrder);
$lon = $this->app->getUserStateFromRequest($layoutData->baseContext . 'lon' . $this->renderOrder, 'radius_search_lon' . $this->renderOrder);
$o = FabrikString::mapStrToCoords($layoutData->geocodeDefault);
$layoutData->defaultLat = $lat ? $lat : (double) $o->lat;
$layoutData->defaultLon = $lon ? $lon : (double) $o->long;
$layoutData->defaultZoom = (int) $o->zoom === 0 ? 7 : (int) $o->zoom;
$layoutData->lat = $lat;
$layoutData->lon = $lon;
$active = $this->app->getUserStateFromRequest($layoutData->baseContext . 'radius_search_active', 'radius_search_active' . $this->renderOrder, array($layoutData->startActive));
$layoutData->active = $active[0];
$layout = $this->getLayout('filters');
$str = $layout->render($layoutData);
$f->element = $str;
$f->required = '';
if ($this->app->input->get('format') !== 'raw') {
FabrikHelperHTML::addStyleDeclaration("table.radius_table{border-collapse:collapse;border:0;}\n\t\t\ttable.radius_table td{border:0;}");
}
JText::script('PLG_VIEW_RADIUS_NO_GEOLOCATION_AVAILABLE');
JText::script('COM_FABRIK_SEARCH');
JText::script('PLG_LIST_RADIUS_SEARCH');
JText::script('PLG_LIST_RADIUS_SEARCH_BUTTON');
$mapElement = $this->getMapElement();
$mapName = $mapElement->getFullName(true, false);
$model->viewfilters[$mapName] = $f;
}
示例5: debug
/**
* add a debug out put section
* @param mixed string/object $content
* @param string $title
*/
function debug($content, $title = 'output:')
{
$config =& JComponentHelper::getParams('com_fabrik');
if ($config->get('use_fabrikdebug') == 0) {
return;
}
if (JRequest::getBool('fabrikdebug', 0, 'request') != 1) {
return;
}
if (JRequest::getVar('format') == 'raw') {
return;
}
echo "<div class=\"fabrikDebugOutputTitle\">{$title}</div>";
echo "<div class=\"fabrikDebugOutput fabrikDebugHidden\">";
if (is_object($content) || is_array($content)) {
echo "<pre>";
print_r($content);
echo "</pre>";
} else {
echo $content;
}
echo "</div>";
static $debug;
if (!isset($debug)) {
$debug = true;
$document = JFactory::getDocument();
$style = ".fabrikDebugOutputTitle{padding:5px;background:#efefef;color:#333;border:1px solid #999;cursor:pointer}";
$style .= ".fabrikDebugOutput{padding:5px;background:#efefef;color:#999;}";
$style .= ".fabrikDebugOutput pre{padding:5px;background:#efefef;color:#999;}";
$style .= ".fabrikDebugHidden{display:none}";
FabrikHelperHTML::addStyleDeclaration($style);
$script = "head.ready(function() {\r\n\t\t\t\$\$('.fabrikDebugOutputTitle').each(function(title) {\r\n\t\t\t\ttitle.addEvent('click', function(e) {\r\n\t\t\t\t\ttitle.getNext().toggleClass('fabrikDebugHidden');\r\n\t\t\t\t});\r\n\t\t\t});\r\n\t\t\t})";
FabrikHelperHTML::addScriptDeclaration($script);
}
}
示例6: foreach
foreach ($this->rows as $groupedby => $group) {
if ($this->isGrouped) {
echo "<li class=\"title\">" . $this->grouptemplates[$groupedby] . "</li>";
}
foreach ($group as $this->_row) {
echo $this->loadTemplate('row');
}
}
?>
</ul>
<?php
echo $this->nav;
print_r($this->hiddenFields);
?>
</div>
</form>
<?php
echo $this->table->outro;
?>
<?php
$doc = JFactory::getDocument();
//$style = $this->params->get('mobile_image') == '' ? 'musiclist' : 'list';
$style = 'list';
$doc->addScriptDeclaration("head.ready(function(){\ndocument.body.addClass('{$style}');\n})");
if ($this->params->get('mobile_image') == '') {
FabrikHelperHTML::addStyleDeclaration('body.list li.withimage .comment,
body.list li.withimage .name{
margin-left:10px !important
}');
}
示例7: plupload
/**
* Create the html plupload widget plus css
* @param string current html output
* @param int repeat group counter
* @param array existing files
* @return modified fileupload html
*/
protected function plupload($str, $repeatCounter, $values)
{
FabrikHelperHTML::stylesheet(COM_FABRIK_LIVESITE . 'media/com_fabrik/css/slider.css');
$id = $this->getHTMLId($repeatCounter);
$params =& $this->getParams();
$runtimes = $params->get('ajax_runtime', 'html5');
$this->pluploadLRuntimes($runtimes);
$pstr = '<!-- UPLOAD CONTAINER -->
<div id="' . $id . '-widgetcontainer">';
if ($params->get('fileupload_crop', 0)) {
$pstr .= '
<canvas id="' . $id . '-widget" width="400" height="400"></canvas>
<div class="zoom" style="float:left;margin-top:10px;padding-right:10x;width:200px">
zoom:
<div class="fabrikslider-line" style="width: 100px;float:left;">
<div class="knob"></div>
</div>
<input name="zoom-val" value="" size="3" />
</div>
<div class="rotate" style="float:left;margin-top:10px;width:200px">' . JText::_('PLG_ELEMENT_FILEUPLOAD_ROTATE') . ':
<div class="fabrikslider-line" style="width: 100px;float:left;">
<div class="knob"></div>
</div>
<input name="rotate-val" value="" size="3" />
</div>
<div style="text-align: right;float:right;margin-top:10px; width: 205px">
<input type="button" class="button" name="close-crop" value="' . JText::_('CLOSE') . '" />
</div>
</div>';
}
$pstr .= '
<div class="plupload_container fabrikHide" id="' . $id . '_container">
<div class="plupload">
<div class="plupload_header">
<div class="plupload_header_content">
<div class="plupload_header_title">' . JText::_('PLG_ELEMENT_FILEUPLOAD_PLUP_HEADING') . '</div>
<div class="plupload_header_text">' . JText::_('PLG_ELEMENT_FILEUPLOAD_PLUP_SUB_HEADING') . '</div>
</div>
</div>
<div class="plupload_content">
<div class="plupload_filelist_header">
<div class="plupload_file_name">' . JText::_('PLG_ELEMENT_FILEUPLOAD_FILENAME') . '</div>
<div class="plupload_file_action"> </div>
<div class="plupload_file_status"><span>' . JText::_('PLG_ELEMENT_FILEUPLOAD_STATUS') . '</span></div>
<div class="plupload_file_size">' . JText::_('PLG_ELEMENT_FILEUPLOAD_SIZE') . '</div>
<div class="plupload_clearer"> </div>
</div>
<ul class="plupload_filelist" id="' . $id . '_dropList">
<li class="plupload_droptext">' . JText::_('PLG_ELEMENT_FILEUPLOAD_DRAG_FILES_HERE') . '</li>
</ul>
<div class="plupload_filelist_footer">
<div class="plupload_file_name">
<div class="plupload_buttons">
<a id="' . $id . '_browseButton" class="plupload_button plupload_add" href="#">' . JText::_('PLG_ELEMENT_FILEUPLOAD_ADD_FILES') . '</a>
<a class="plupload_button plupload_start plupload_disabled" href="#">' . JText::_('PLG_ELEMENT_FILEUPLOAD_START_UPLOAD') . '</a>
</div>
<span class="plupload_upload_status"></span>
</div>
<div class="plupload_file_action"></div>
<div class="plupload_file_status">
<span class="plupload_total_status">0%</span>
</div>
<div class="plupload_file_size">
<span class="plupload_total_file_size">0 b</span>
</div>
<div class="plupload_progress">
<div class="plupload_progress_container">
<div class="plupload_progress_bar"></div>
</div>
</div>
<div class="plupload_clearer"> </div>
</div>
</div>
</div>
</div>
<!-- FALLBACK; SHOULD LOADING OF PLUPLOAD FAIL -->
<div class="plupload_fallback">' . JText::_('PLG_ELEMENT_FILEUPLOAD_FALLBACK_MESSAGE') . '
<br />
' . $str . '
</div>';
$w = (int) $params->get('ajax_dropbox_width', 300);
$h = (int) $params->get('ajax_dropbox_hight', 200);
FabrikHelperHTML::stylesheet(COM_FABRIK_LIVESITE . 'plugins/fabrik_element/fileupload/plupload/css/plupload.queue.css');
FabrikHelperHTML::addStyleDeclaration(".dropList{background:#aaa; width:" . $w . "px; height:" . $h . "px;}");
return $pstr;
}