本文整理匯總了PHP中FabrikHelperHTML::windows方法的典型用法代碼示例。如果您正苦於以下問題:PHP FabrikHelperHTML::windows方法的具體用法?PHP FabrikHelperHTML::windows怎麽用?PHP FabrikHelperHTML::windows使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類FabrikHelperHTML
的用法示例。
在下文中一共展示了FabrikHelperHTML::windows方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: viewDataLink
/**
* Build the link (<a href..>) for viewing list data
*
* @param bool $popUp is the link to generated a popup to show
* @param object $element 27/06/2011
* @param object $row current list row data
* @param string $key 28/06/2011 - do longer passed in with _raw appended (done in this method)
* @param string $val value
* @param int $count number of related records
* @param int $f ref to related data admin info 27/16/2011
*
* @return string
*/
public function viewDataLink($popUp = false, $element = null, $row = null, $key = '', $val = '', $count = 0, $f = null)
{
$elKey = $element->list_id . '-' . $element->form_id . '-' . $element->element_id;
$listid = $element->list_id;
$app = JFactory::getApplication();
$params = $this->getParams();
$factedLinks = $params->get('factedlinks');
/* $$$ hugh - we are getting element keys that aren't in the linkedlisttext.
* not sure why, so added this defensive code. Should probably find out
* why though! I just needed to make this error go away NAO!
*/
$linkedListText = isset($factedLinks->linkedlisttext->{$elKey}) ? $factedLinks->linkedlisttext->{$elKey} : '';
$label = $this->parseMessageForRowHolder($linkedListText, JArrayHelper::fromObject($row));
$Itemid = $app->isAdmin() ? 0 : @$app->getMenu('site')->getActive()->id;
$action = $app->isAdmin() ? 'task' : 'view';
$url = 'index.php?option=com_fabrik&';
if (is_null($listid)) {
$list = $this->getTable();
$listid = $list->id;
}
$facetTable = $this->_facetedTable($listid);
if (!$facetTable->canView()) {
return '<div style="text-align:center"><a title="' . JText::_('COM_FABRIK_NO_ACCESS_PLEASE_LOGIN') . '"><img src="media/com_fabrik/images/login.png" alt="' . JText::_('COM_FABRIK_NO_ACCESS_PLEASE_LOGIN') . '" /></a></div>';
}
$tlabel = $label === '' ? JText::_('COM_FABRIK_NO_RECORDS') : '(0) ' . $label;
if ($count === 0) {
$aExisitngLinkedForms = (array) $params->get('linkedform');
$linkedForm = JArrayHelper::getValue($aExisitngLinkedForms, $f, false);
$addLink = $linkedForm == '0' ? $this->viewFormLink($popUp, $element, $row, $key, $val, false, $f) : '';
return '<div style="text-align:center" class="related_data_norecords">' . $tlabel . '</div>' . $addLink;
}
$key .= '_raw';
if ($label === '') {
$label = JText::_('COM_FABRIK_VIEW');
}
$label = '(' . $count . ') ' . $label;
if ($app->isAdmin()) {
$bits[] = 'task=list.view';
$bits[] = 'cid=' . $listid;
} else {
$bits[] = 'view=list';
$bits[] = 'listid=' . $listid;
$listLinks = $this->getTableLinks();
// $$$ rob 01/03/2011 find at matching itemid in another menu item for the related data link
foreach ($listLinks as $listLink) {
if (strstr($listLink->link, 'index.php?option=com_fabrik&view=list&listid=' . $listid)) {
$bits[] = 'Itemid=' . $listLink->id;
$Itemid = $listLink->id;
break;
}
}
$bits[] = 'Itemid=' . $Itemid;
}
if ($key != '') {
$bits[] = $key . '=' . $val;
}
$bits[] = 'limitstart' . $listid . '=0';
if ($popUp) {
$bits[] = 'tmpl=component';
$bits[] = 'ajax=1';
}
$bits[] = '&resetfilters=1';
// Nope stops url filter form workin on related data :(
// $bits[] = 'clearfilters=1';
// Test for releated data, filter once, go backt o main list re-filter -
$bits[] = '&fabrik_incsessionfilters=0';
$url .= implode('&', $bits);
$url = JRoute::_($url);
if ($popUp) {
FabrikHelperHTML::windows('a.popupwin');
$opts = new stdClass();
$opts->maximizable = 1;
$opts->title = JText::_('COM_FABRIK_VIEW');
$opts->evalScripts = 1;
$opts = str_replace('"', "'", json_encode($opts));
$url = '<a rel="' . $opts . '" href="' . $url . '" class="popupwin">' . $label . '</a>';
} else {
$url = '<a class="related_data" href="' . $url . '">' . $label . "</a>";
}
return $url;
}
示例2: _addJavascript
/**
* Append the form javascript into the document head
*
* @param int $listId table id
*
* @return void|boolean
*/
protected function _addJavascript($listId)
{
$pluginManager = FabrikWorker::getPluginManager();
/** @var FabrikFEModelForm $model */
$model = $this->getModel();
$aLoadedElementPlugins = array();
$jsActions = array();
$bKey = $model->jsKey();
$srcs = FabrikHelperHTML::framework();
$shim = array();
if (!defined('_JOS_FABRIK_FORMJS_INCLUDED')) {
define('_JOS_FABRIK_FORMJS_INCLUDED', 1);
FabrikHelperHTML::slimbox();
$dep = new stdClass();
$dep->deps = array('fab/element', 'lib/form_placeholder/Form.Placeholder', 'fab/encoder');
$shim['fabrik/form'] = $dep;
$deps = new stdClass();
$deps->deps = array('fab/fabrik', 'fab/element', 'fab/form-submit');
$framework['fab/elementlist'] = $deps;
$srcs[] = 'media/com_fabrik/js/lib/form_placeholder/Form.Placeholder.js';
FabrikHelperHTML::addToFrameWork($srcs, 'media/com_fabrik/js/form');
FabrikHelperHTML::addToFrameWork($srcs, 'media/com_fabrik/js/form-submit');
FabrikHelperHTML::addToFrameWork($srcs, 'media/com_fabrik/js/element');
}
$aWYSIWYGNames = array();
// $$$ hugh - yet another one where if we =, the $groups array pointer get buggered up and it
// skips a group
$groups = $model->getGroupsHiarachy();
foreach ($groups as $groupModel) {
$elementModels = $groupModel->getPublishedElements();
foreach ($elementModels as $elementModel) {
$res = $elementModel->useEditor();
if ($res !== false && $elementModel->canUse() && $model->isEditable()) {
$aWYSIWYGNames[] = $res;
}
// Load in once the element js class files
$element = $elementModel->getElement();
if (!in_array($element->plugin, $aLoadedElementPlugins)) {
/* $$$ hugh - certain elements, like file-upload, need to load different JS files
* on a per-element basis, so as a test fix, I modified the file-upload's formJavaScriptClass to return false,
* and test for that here, so as to not add it to aLoadedElementPlugins[]. The existing 'static' tests in
* formJavascriptClass() should still prevent scripts being added twice.
*/
if ($elementModel->formJavascriptClass($srcs, '', $shim) !== false) {
$aLoadedElementPlugins[] = $element->plugin;
}
}
$eventMax = $groupModel->repeatTotal == 0 ? 1 : $groupModel->repeatTotal;
for ($c = 0; $c < $eventMax; $c++) {
$jsAct = $elementModel->getFormattedJSActions($bKey, $c);
if (!empty($jsAct)) {
$jsActions[] = $jsAct;
}
}
}
}
FabrikHelperHTML::iniRequireJS($shim);
$actions = trim(implode("\n", $jsActions));
FabrikHelperHTML::windows('a.fabrikWin');
FabrikHelperHTML::tips('.hasTip', array(), "\$('{$bKey}')");
$model->getFormCss();
$opts = $this->jsOpts();
$model->jsOpts = $opts;
$pluginManager->runPlugins('onJSOpts', $model);
$opts = json_encode($model->jsOpts);
if (!FabrikHelperHTML::inAjaxLoadedPage()) {
JText::script('COM_FABRIK_VALIDATING');
JText::script('COM_FABRIK_SUCCESS');
JText::script('COM_FABRIK_NO_REPEAT_GROUP_DATA');
JText::script('COM_FABRIK_VALIDATION_ERROR');
JText::script('COM_FABRIK_CONFIRM_DELETE_1');
}
JText::script('COM_FABRIK_FORM_SAVED');
// $$$ rob don't declare as var $bKey, but rather assign to window, as if loaded via ajax window the function is wrapped
// inside an anonymous function, and therefore $bKey wont be available as a global var in window
$script = array();
$script[] = "\t\tvar {$bKey} = Fabrik.form('{$bKey}', " . $model->getId() . ", {$opts});";
// Instantiate js objects for each element
$vstr = "\n";
$groups = $model->getGroupsHiarachy();
$script[] = "\tFabrik.blocks['{$bKey}'].addElements(";
$groupedJs = new stdClass();
foreach ($groups as $groupModel) {
$groupId = $groupModel->getGroup()->id;
$groupedJs->{$groupId} = array();
if (!$groupModel->canView('form')) {
continue;
}
$elementJs = array();
$elementModels = $groupModel->getPublishedElements();
// $$$ rob if repeatTotal is 0 we still want to add the js objects as the els are only hidden
$max = $groupModel->repeatTotal > 0 ? $groupModel->repeatTotal : 1;
foreach ($elementModels as $elementModel) {
//.........這裏部分代碼省略.........
示例3: mocha
/**
* load up window code - should be run in ajax loaded pages as well
* might be an issue in that we may be re-observing some links when loading in - need to check
* @deprecated use windows() instead
* @param string element select to auto create windows for - was default = a.modal
*/
public static function mocha($selector = '', $params = array())
{
FabrikHelperHTML::windows($selector, $params);
}