本文整理匯總了PHP中FabrikHelperHTML::loadcalendar方法的典型用法代碼示例。如果您正苦於以下問題:PHP FabrikHelperHTML::loadcalendar方法的具體用法?PHP FabrikHelperHTML::loadcalendar怎麽用?PHP FabrikHelperHTML::loadcalendar使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類FabrikHelperHTML
的用法示例。
在下文中一共展示了FabrikHelperHTML::loadcalendar方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: getManagementJS
protected function getManagementJS($data = array())
{
global $Itemid;
// $$$ rob ALWAYS load the calendar (so its avaible in ajax forms)
FabrikHelperHTML::loadcalendar();
$app =& JFactory::getApplication();
$model =& $this->getModel();
$table =& $model->getTable();
$formModel =& $model->getForm();
$elementsNotInTable =& $formModel->getElementsNotInTable();
$keys = array('id' => '', 'name' => '', 'label' => '');
foreach ($elementsNotInTable as &$i) {
if (is_a($i, 'TableElement')) {
$i = array_intersect_key($i->getPublicProperties(), $keys);
}
}
FabrikHelperHTML::packageJS();
$document =& JFactory::getDocument();
if ($model->requiresSlimbox()) {
FabrikHelperHTML::slimbox();
}
if ($model->requiresMocha()) {
FabrikHelperHTML::mocha();
}
FabrikHelperHTML::script('table.js', 'media/com_fabrik/js/', true);
$tmpl = $this->getTmpl();
FabrikHelperHTML::stylesheet('table.css', 'media/com_fabrik/css/');
// check for a custom css file and include it if it exists
FabrikHelperHTML::stylesheetFromPath("components" . DS . "com_fabrik" . DS . "views" . DS . "table" . DS . "tmpl" . DS . $tmpl . DS . "template.css");
//check and add a general fabrik custom css file overrides template css and generic table css
FabrikHelperHTML::stylesheetFromPath("media" . DS . "com_fabrik" . DS . "css" . DS . "custom.css");
//check and add a specific table template css file overrides template css generic table css and generic custom css
FabrikHelperHTML::stylesheetFromPath("components" . DS . "com_fabrik" . DS . "views" . DS . "table" . DS . "tmpl" . DS . $tmpl . DS . "custom.css");
// check for a custom js file and include it if it exists
$aJsPath = JPATH_SITE . DS . "components" . DS . "com_fabrik" . DS . "views" . DS . "table" . DS . "tmpl" . DS . $tmpl . DS . "javascript.js";
if (JFile::exists($aJsPath)) {
FabrikHelperHTML::script("javascript.js", 'components/com_fabrik/views/table/tmpl/' . $tmpl . '/', true);
}
$origRows = $this->rows;
$this->rows = array(array());
$tmpItemid = !isset($Itemid) ? 0 : $Itemid;
$this->_c = 0;
$this->_row = new stdClass();
$script = '';
// $$$ rob done in HTMLHelper
//$script = "/* <![CDATA[ */ \n";
static $tableini;
if (!$tableini) {
$tableini = true;
$script .= "var oTables = \$H();\n";
}
$opts = new stdClass();
$opts->admin = $app->isAdmin();
$opts->postMethod = $model->getPostMethod();
$opts->filterMethod = $this->filter_action;
$opts->form = 'tableform_' . $model->_id;
$opts->headings = $model->_jsonHeadings();
$labels = $this->headings;
foreach ($labels as &$l) {
$l = strip_tags($l);
}
$opts->labels = $labels;
$opts->primaryKey = $table->db_primary_key;
$opts->Itemid = $tmpItemid;
$opts->formid = $model->_oForm->getId();
$opts->canEdit = $model->canEdit() ? "1" : "0";
$opts->canView = $model->canView() ? "1" : "0";
$opts->page = JRoute::_('index.php');
$opts->isGrouped = $this->isGrouped;
$opts->mooversion = FabrikWorker::getMooVersion() == 1 ? 1.2 : 1.1;
if (FabrikWorker::nativeMootools12()) {
$opts->mooversion = 1.24;
}
$opts->formels = $elementsNotInTable;
//if table data starts as empty then we need the html from the row
// template otherwise we can't add a row to the table
if ($model->_postMethod == 'ajax') {
ob_start();
$this->_row = new stdClass();
$this->_row->id = '';
$this->_row->class = 'fabrik_row';
require COM_FABRIK_FRONTEND . DS . 'views' . DS . 'table' . DS . 'tmpl' . DS . 'default' . DS . 'default_row.php';
$opts->rowtemplate = ob_get_contents();
ob_end_clean();
}
//$$$rob if you are loading a table in a window from a form db join select record option
// then we want to know the id of the window so we can set its showSpinner() method
$opts->winid = JRequest::getVar('winid', '');
$opts->ajaxEditViewLink = $model->ajaxEditViewLink() ? 1 : 0;
$opts = json_encode($opts);
$lang = new stdClass();
$lang->select_rows = JText::_('SELECT SOME ROWS FOR DELETION');
$lang->yes = JText::_('Yes');
$lang->no = JText::_('No');
$lang->select_colums_to_export = JText::_('SELECT_COLUMNS_TO_EXPORT');
$lang->include_filters = JText::_('INCLUDE_FILTERS');
$lang->include_data = JText::_('INCLUDE_DATA');
$lang->inlcude_raw_data = JText::_('INCLUDE_RAW_DATA');
$lang->include_calculations = JText::_('INLCUDE_CALCULATIONS');
$lang->export = JText::_('EXPORT');
//.........這裏部分代碼省略.........
示例2: foreach
/**
* Get the table filter for the element
* @param int repeat group counter
* @param bol do we render as a normal filter or as an advanced search filter
* if normal include the hidden fields as well (default true, use false for advanced filter rendering)
* @return string filter html
*/
function &getFilter($counter, $normal = true)
{
$params =& $this->getParams();
$listModel =& $this->getListModel();
$table =& $listModel->getTable();
$element = $this->getElement();
$origTable = $table->db_table_name;
$fabrikDb =& $listModel->getDb();
$elName = $this->getFullName(false, true, false);
$elName2 = $this->getFullName(false, false, false);
$ids = $listModel->getColumnData($elName2);
$v = 'fabrik___filter[list_' . $table->id . '][value][' . $counter . ']';
//corect default got
$default = $this->getDefaultFilterVal($normal, $counter);
$format = $params->get('date_table_format', '%Y-%m-%d');
$fromTable = $origTable;
$joinStr = '';
// $$$ hugh - in advanced search, _aJoins wasn't getting set
$joins = $listModel->getJoins();
foreach ($joins as $aJoin) {
// not sure why the group id key wasnt found - but put here to remove error
if (array_key_exists('group_id', $aJoin)) {
if ($aJoin->group_id == $element->group_id && $aJoin->element_id == 0) {
$fromTable = $aJoin->table_join;
$joinStr = " LEFT JOIN {$fromTable} ON " . $aJoin->table_join . "." . $aJoin->table_join_key . " = " . $aJoin->join_from_table . "." . $aJoin->table_key;
$elName = str_replace($origTable . '.', $fromTable . '.', $elName);
}
}
}
$where = $listModel->_buildQueryPrefilterWhere($this);
$elName = FabrikString::safeColName($elName);
//dont format here as the format string is different between mysql and php's calendar strftime
$sql = "SELECT DISTINCT({$elName}) AS text, {$elName} AS value FROM `{$origTable}` {$joinStr}" . "\n WHERE {$elName} IN ('" . implode("','", $ids) . "')" . "\n AND TRIM({$elName}) <> '' {$where} GROUP BY text ASC";
$requestName = $elName . "___filter";
if (array_key_exists($elName, $_REQUEST)) {
if (is_array($_REQUEST[$elName]) && array_key_exists('value', $_REQUEST[$elName])) {
$_REQUEST[$requestName] = $_REQUEST[$elName]['value'];
}
}
$htmlid = $this->getHTMLId();
$tzoffset = new DateTimeZone(JFactory::getConfig()->get('offset'));
if (in_array($element->filter_type, array('dropdown'))) {
$rows = $this->filterValueList($normal);
}
$calOpts = array('class' => 'inputbox fabrik_filter', 'maxlength' => '19', 'size' => 16);
switch ($element->filter_type) {
case "range":
FabrikHelperHTML::loadcalendar();
//@TODO: this messes up if the table date format is different to the form date format
if (empty($default)) {
$default = array('', '');
}
$v = 'fabrik___filter[table_' . $table->id . '][value][' . $counter . ']';
$return = JText::_('COM_FABRIK_DATE_RANGE_BETWEEN') . $this->calendar($default[0], $v . '[0]', $this->getHTMLId() . "_filter_range_0_" . JRequest::getVar('task'), $format, $calOpts);
$return .= "<br />" . JText::_('COM_FABRIK_DATE_RANGE_AND') . $this->calendar($default[1], $v . '[1]', $this->getHTMLId() . "_filter_range_1" . JRequest::getVar('task'), $format, $calOpts);
break;
case "dropdown":
// cant do the format in the MySQL query as its not the same formatting
// e.g. M in mysql is month and J's date code its minute
jimport('joomla.utilities.date');
$ddData = array();
foreach ($rows as $k => $o) {
if ($fabrikDb->getNullDate() === $o->text) {
$o->text = '';
$o->value = '';
} else {
$d = new JDate($o->text);
//@TODO add an option as to whether we format values or not (if records as timestamps we don't want to format the filter value as running
// the filter will result in no records found. see http://fabrikar.com/forums/showthread.php?t=10964
$o->value = $d->toFormat($format);
//if we have a table format like %m-%d then we want to remove duplicate full times
$o->text = $d->toFormat($format);
}
if (!array_key_exists($o->value, $ddData)) {
$ddData[$o->value] = $o;
}
}
array_unshift($ddData, JHTML::_('select.option', '', $this->filterSelectLabel()));
$return = JHTML::_('select.genericlist', $ddData, $v, 'class="inputbox fabrik_filter" size="1" maxlength="19"', 'value', 'text', $default, $htmlid . "_filter_range_0");
break;
default:
case "field":
FabrikHelperHTML::loadcalendar();
if (is_array($default)) {
$default = array_shift($default);
}
if (get_magic_quotes_gpc()) {
$default = stripslashes($default);
}
$default = htmlspecialchars($default);
$return = $this->calendar($default, $v, $htmlid . "_filter_range_0_" . JRequest::getVar('task'), $format, $calOpts);
break;
case 'auto-complete':
//.........這裏部分代碼省略.........
示例3: getFilter
/**
* Get the list filter for the element
* @param int filter order
* @param bol do we render as a normal filter or as an advanced search filter
* if normal include the hidden fields as well (default true, use false for advanced filter rendering)
* @return string filter html
*/
function getFilter($counter, $normal = true)
{
$params = $this->getParams();
$listModel = $this->getListModel();
$table = $listModel->getTable();
$element = $this->getElement();
$origTable = $table->db_table_name;
$fabrikDb = $listModel->getDb();
$elName = $this->getFullName(false, true, false);
$elName2 = $this->getFullName(false, false, false);
$ids = $listModel->getColumnData($elName2);
$v = $this->filterName($counter, $normal);
//corect default got
$default = $this->getDefaultFilterVal($normal, $counter);
$format = $params->get('date_table_format', '%Y-%m-%d');
$fromTable = $origTable;
$joinStr = '';
// $$$ hugh - in advanced search, _aJoins wasn't getting set
$joins = $listModel->getJoins();
foreach ($joins as $aJoin) {
// not sure why the group id key wasnt found - but put here to remove error
if (array_key_exists('group_id', $aJoin)) {
if ($aJoin->group_id == $element->group_id && $aJoin->element_id == 0) {
$fromTable = $aJoin->table_join;
$joinStr = " LEFT JOIN {$fromTable} ON " . $aJoin->table_join . "." . $aJoin->table_join_key . " = " . $aJoin->join_from_table . "." . $aJoin->table_key;
$elName = str_replace($origTable . '.', $fromTable . '.', $elName);
}
}
}
$where = $listModel->_buildQueryPrefilterWhere($this);
$elName = FabrikString::safeColName($elName);
//dont format here as the format string is different between mysql and php's calendar strftime
$sql = "SELECT DISTINCT({$elName}) AS text, {$elName} AS value FROM `{$origTable}` {$joinStr}" . "\n WHERE {$elName} IN ('" . implode("','", $ids) . "')" . "\n AND TRIM({$elName}) <> '' {$where} GROUP BY text ASC";
$requestName = $elName . "___filter";
if (array_key_exists($elName, $_REQUEST)) {
if (is_array($_REQUEST[$elName]) && array_key_exists('value', $_REQUEST[$elName])) {
$_REQUEST[$requestName] = $_REQUEST[$elName]['value'];
}
}
$htmlid = $this->getHTMLId();
$timeZone = new DateTimeZone(JFactory::getConfig()->get('offset'));
if (in_array($element->filter_type, array('dropdown'))) {
$rows = $this->filterValueList($normal);
}
$calOpts = $this->filterCalendarOpts();
$return = array();
switch ($element->filter_type) {
case "range":
FabrikHelperHTML::loadcalendar();
if (empty($default)) {
$default = array('', '');
} else {
$default[0] = JFactory::getDate($default[0])->toFormat($format);
$default[1] = JFactory::getDate($default[1])->toFormat($format);
}
$return[] = JText::_('COM_FABRIK_DATE_RANGE_BETWEEN') . $this->calendar($default[0], $v . '[0]', $this->getHTMLId() . "_filter_range_0_" . JRequest::getVar('task'), $format, $calOpts);
$return[] = '<br />' . JText::_('COM_FABRIK_DATE_RANGE_AND') . $this->calendar($default[1], $v . '[1]', $this->getHTMLId() . "_filter_range_1_" . JRequest::getVar('task'), $format, $calOpts);
break;
case "dropdown":
// cant do the format in the MySQL query as its not the same formatting
// e.g. M in mysql is month and J's date code its minute
jimport('joomla.utilities.date');
$ddData = array();
foreach ($rows as $k => $o) {
if ($fabrikDb->getNullDate() === $o->text) {
$o->text = '';
$o->value = '';
} else {
$d = new FabDate($o->text);
$o->value = $d->toSql();
$o->text = $d->toFormat($format);
}
if (!array_key_exists($o->value, $ddData)) {
$ddData[$o->value] = $o;
}
}
array_unshift($ddData, JHTML::_('select.option', '', $this->filterSelectLabel()));
$return[] = JHTML::_('select.genericlist', $ddData, $v, 'class="inputbox fabrik_filter" size="1" maxlength="19"', 'value', 'text', $default, $htmlid . "_filter_range_0");
break;
default:
case "field":
FabrikHelperHTML::loadcalendar();
if (is_array($default)) {
$default = array_shift($default);
}
if ($default !== '') {
$default = JFactory::getDate($default)->toFormat($format);
}
$return[] = $this->calendar($default, $v, $htmlid . '_filter_range_0_' . JRequest::getVar('task'), $format, $calOpts);
break;
case 'hidden':
if (is_array($default)) {
$default = array_shift($default);
//.........這裏部分代碼省略.........
示例4: getFilter
/**
* Get the list filter for the element
* Note: uses FabDate as if date element first to be found in advanced search, and advanced search run on another element
* the list model in getAdvancedSearchElementList() builds the first filter (this element) with the data from the first search
* which was throwing '"500 - DateTime::__construct() ' errors
*
* see: http://fabrikar.com/forums/showthread.php?t=28231
*
* @param int $counter Filter order
* @param bool $normal Do we render as a normal filter or as an advanced search filter
* if normal include the hidden fields as well (default true, use false for advanced filter rendering)
*
* @return string filter html
*/
public function getFilter($counter = 0, $normal = true)
{
$params = $this->getParams();
$listModel = $this->getListModel();
$table = $listModel->getTable();
$element = $this->getElement();
$origTable = $table->db_table_name;
$fabrikDb = $listModel->getDb();
$elName = $this->getFullName(true, false);
$elName2 = $this->getFullName(false, false);
$v = $this->filterName($counter, $normal);
$class = $this->filterClass();
// Correct default got
$default = $this->getDefaultFilterVal($normal, $counter);
$format = $params->get('date_table_format', 'Y-m-d');
$fromTable = $origTable;
// $$$ hugh - in advanced search, _aJoins wasn't getting set
$joins = $listModel->getJoins();
foreach ($joins as $aJoin) {
// Not sure why the group id key wasn't found - but put here to remove error
if (array_key_exists('group_id', $aJoin)) {
if ($aJoin->group_id == $element->group_id && $aJoin->element_id == 0) {
$fromTable = $aJoin->table_join;
$elName = str_replace($origTable . '.', $fromTable . '.', $elName);
}
}
}
$where = $listModel->buildQueryPrefilterWhere($this);
$elName = FabrikString::safeColName($elName);
$requestName = $elName . '___filter';
if (array_key_exists($elName, $_REQUEST)) {
if (is_array($_REQUEST[$elName]) && array_key_exists('value', $_REQUEST[$elName])) {
$_REQUEST[$requestName] = $_REQUEST[$elName]['value'];
}
}
$htmlid = $this->getHTMLId();
$fType = $this->getFilterType();
$timeZone = new DateTimeZone(JFactory::getConfig()->get('offset'));
if (in_array($fType, array('dropdown', 'checkbox', 'multiselect'))) {
$rows = $this->filterValueList($normal);
}
$calOpts = $this->filterCalendarOpts();
$return = array();
switch ($fType) {
case 'checkbox':
$return[] = $this->checkboxFilter($rows, $default, $v);
break;
case 'range':
case 'range-hidden':
FabrikHelperHTML::loadcalendar();
if (empty($default)) {
$default = array('', '');
} else {
$d = new FabDate($default[0]);
$default[0] = $d->format($format);
$d = new FabDate($default[1]);
$default[1] = $d->format($format);
}
// Add wrapper div for list filter toggling
$return[] = '<div class="fabrik_filter_container">';
if ($fType === 'range-hidden') {
$return[] = '<input type="hidden" name="' . $v . '[0]' . '" class="' . $class . '" value="' . $default[0] . '" id="' . $htmlid . '-0" />';
$return[] = '<input type="hidden" name="' . $v . '[1]' . '" class="' . $class . '" value="' . $default[1] . '" id="' . $htmlid . '-1" />';
$return[] = '</div>';
} else {
$return[] = JText::_('COM_FABRIK_DATE_RANGE_BETWEEN') . $this->calendar($default[0], $v . '[0]', $this->getFilterHtmlId(0), $format, $calOpts);
$return[] = '<br />' . JText::_('COM_FABRIK_DATE_RANGE_AND') . $this->calendar($default[1], $v . '[1]', $this->getFilterHtmlId(1), $format, $calOpts);
$return[] = '</div>';
}
break;
case 'dropdown':
case 'multiselect':
/**
* cant do the format in the MySQL query as its not the same formatting
* e.g. M in MySQL is month and J's date code its minute
*/
$max = count($rows) < 7 ? count($rows) : 7;
$size = $element->filter_type === 'multiselect' ? 'multiple="multiple" size="' . $max . '"' : 'size="1"';
$v = $fType === 'multiselect' ? $v . '[]' : $v;
jimport('joomla.utilities.date');
$ddData = array();
foreach ($rows as $k => $o) {
if ($fabrikDb->getNullDate() === $o->text) {
$o->text = '';
$o->value = '';
} else {
//.........這裏部分代碼省略.........
示例5: _addJavascript
/**
* append the form javascript into the document head
* @param int table id
*/
function _addJavascript($tableId)
{
// $$$ rob ALWAYS load the calendar (so its avaible in ajax forms)
FabrikHelperHTML::loadcalendar();
$app =& JFactory::getApplication();
$document =& JFactory::getDocument();
$model =& $this->getModel();
$aLoadedElementPlugins = array();
$jsActions = array();
$jsControllerKey = $model->_editable ? 'form_' . $model->getId() : 'details_' . $model->getId();
$allJsActions = $model->getJsActions();
FabrikHelperHTML::packageJS();
if (!defined('_JOS_FABRIK_FORMJS_INCLUDED')) {
define('_JOS_FABRIK_FORMJS_INCLUDED', 1);
FabrikHelperHTML::slimbox();
FabrikHelperHTML::script('form.js', 'media/com_fabrik/js/', true);
FabrikHelperHTML::script('element.js', 'media/com_fabrik/js/', true);
}
$aWYSIWYGNames = array();
// $$$ hugh - yeat 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) {
$aWYSIWYGNames[] = $res;
}
$eparams =& $elementModel->getParams();
//load in once the element js class files
// $$$ hugh - only needed getParent when we weren't saving changes to parent params to child
// which we should now be doing ... and getParent() causes an extra table lookup for every child
// element on the form.
//$element =& $elementModel->getParent();
$element =& $elementModel->getElement();
if (!in_array($element->plugin, $aLoadedElementPlugins)) {
$aLoadedElementPlugins[] = $element->plugin;
$elementModel->formJavascriptClass();
}
$eventMax = $groupModel->_repeatTotal == 0 ? 1 : $groupModel->_repeatTotal;
for ($c = 0; $c < $eventMax; $c++) {
$jsActions[] = $elementModel->getFormattedJSActions($allJsActions, $jsControllerKey, $c);
}
}
}
//new
$actions = trim(implode("\n", $jsActions));
//end new
$params =& $model->getParams();
$tableModel =& $model->getTableModel();
$table =& $tableModel->getTable();
$form =& $model->getForm();
FabrikHelperHTML::mocha();
$bkey = $model->_editable ? 'form_' . $model->getId() : 'details_' . $model->getId();
FabrikHelperHTML::tips('.hasTip', array(), "\$('{$bkey}')");
$key = FabrikString::safeColNameToArrayKey($table->db_primary_key);
$this->get('FormCss');
$this->get('CustomJsAction');
//$startJs = "window.addEvent('domready', function() {\n";
$startJs = "window.addEvent('" . FabrikHelperHTML::useLoadEvent() . "', function() {\n";
$endJs = "});\n";
$start_page = isset($model->sessionModel->last_page) ? (int) $model->sessionModel->last_page : 0;
if ($start_page !== 0) {
$app->enqueueMessage(JText::_('RESTARTINGMUTLIPAGEFORM'));
} else {
// form submitted but fails validation - needs to go to the last page
$start_page = JRequest::getInt('currentPage', 0);
}
$opts = new stdClass();
$opts->admin = $app->isAdmin();
$opts->postMethod = $this->get('PostMethod');
$opts->ajaxValidation = $params->get('ajax_validations');
$opts->primaryKey = $key;
$opts->liveSite = COM_FABRIK_LIVESITE;
$opts->error = @$form->origerror;
$opts->pages = $model->getPages();
$opts->plugins = array();
$opts->multipage_save = (bool) $model->saveMultiPage();
$opts->editable = $model->_editable;
$opts->start_page = $start_page;
$opts->mooversion = FabrikWorker::getMooVersion() == 1 ? 1.2 : 1.1;
//$$$rob dont int this as keys may be string
$opts->rowid = $model->_rowId;
//$$$rob if you are loading a table in a window from a form db join select record option
// then we want to know the id of the window so we can set its showSpinner() method
$opts->winid = JRequest::getVar('winid', '');
//for editing groups with joined data and an empty joined record (ie no joined records)
$hidden = array();
$maxRepeat = array();
$showMaxRepeats = array();
$postedRepeatGroupCounts = (array) JRequest::getVar('fabrik_repeat_group');
foreach ($this->groups as $g) {
$hidden[$g->id] = $g->startHidden;
if (JArrayHelper::getValue($postedRepeatGroupCounts, $g->id, 1) == 0) {
$hidden[$g->id] = true;
//.........這裏部分代碼省略.........