本文整理汇总了PHP中FabrikString类的典型用法代码示例。如果您正苦于以下问题:PHP FabrikString类的具体用法?PHP FabrikString怎么用?PHP FabrikString使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了FabrikString类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: ajax_loadTableDropDown
/**
* Ajax load drop down of all columns in a given table
*
* @return null
*/
public function ajax_loadTableDropDown()
{
$app = JFactory::getApplication();
$input = $app->input;
$conn = $input->getInt('conn', 1);
$oCnn = JModelLegacy::getInstance('Connection', 'FabrikFEModel');
$oCnn->setId($conn);
$oCnn->getConnection();
$db = $oCnn->getDb();
$table = $input->get('table', '');
$fieldNames = array();
$name = $input->get('name', 'jform[params][table_key][]', '', 'string');
if ($table != '') {
$table = FabrikString::safeColName($table);
$sql = 'DESCRIBE ' . $table;
$db->setQuery($sql);
$aFields = $db->loadObjectList();
if (is_array($aFields)) {
foreach ($aFields as $oField) {
$fieldNames[] = JHTML::_('select.option', $oField->Field);
}
}
}
$fieldDropDown = JHTML::_('select.genericlist', $fieldNames, $name, "class=\"inputbox\" size=\"1\" ", 'value', 'text', '');
echo $fieldDropDown;
}
开发者ID:LGBGit,项目名称:tierno,代码行数:31,代码来源:list.raw.php
示例2: _process
/**
* Clone the record
*
* @return bool
*/
private function _process()
{
$params = $this->getParams();
/** @var FabrikFEModelForm $formModel */
$formModel = $this->getModel();
$clone_times_field_id = $params->get('clone_times_field', '');
$clone_batchid_field_id = $params->get('clone_batchid_field', '');
if ($clone_times_field_id != '') {
$elementModel = FabrikWorker::getPluginManager()->getElementPlugin($clone_times_field_id);
$element = $elementModel->getElement(true);
if ($clone_batchid_field_id != '') {
$elementModel = FabrikWorker::getPluginManager()->getElementPlugin($clone_batchid_field_id);
$id_element = $elementModel->getElement(true);
$formModel->formData[$id_element->name] = $formModel->fullFormData['rowid'];
$formModel->formData[$id_element->name . '_raw'] = $formModel->fullFormData['rowid'];
$listModel = $formModel->getlistModel();
$listModel->setFormModel($formModel);
$primaryKey = FabrikString::shortColName($listModel->getPrimaryKey());
$formModel->formData[$primaryKey] = $formModel->fullFormData['rowid'];
$formModel->formData[$primaryKey . '_raw'] = $formModel->fullFormData['rowid'];
$listModel->storeRow($formModel->formData, $formModel->fullFormData['rowid']);
}
$clone_times = $formModel->formData[$element->name];
if (is_numeric($clone_times)) {
$clone_times = (int) $clone_times;
$formModel->formData['Copy'] = 1;
for ($x = 1; $x < $clone_times; $x++) {
$formModel->processToDB();
}
return true;
}
}
throw new RuntimeException("Couldn't find a valid number of times to clone!");
}
开发者ID:jfquestiaux,项目名称:fabrik,代码行数:39,代码来源:clone.php
示例3: getPivot
/**
* create the pivot data
* @return array of objects - first being the headings, subsequent the data
*/
public function getPivot()
{
$model = $this->formModel->getTableModel();
$params =& $model->getParams();
$val = FabrikString::safeColName($params->get('pivot_value', ''));
$xCol = FabrikString::safeColName($params->get('pivot_xcol', ''));
$yCol = FabrikString::safeColName($params->get('pivot_ycol', ''));
$db =& $model->getDb();
$table =& $model->getTable();
$join = $model->_buildQueryJoin();
$where = $model->_buildQueryWhere();
$db->setQuery("SELECT DISTINCT {$yCol} FROM {$table->db_table_name}");
$yCols = $db->loadResultArray();
$query = "select name,\n";
$data = array();
foreach ($yCols as $c) {
$data[] = "SUM({$val}*(1-abs(sign(" . $yCol . "-" . $c . ")))) as exam" . $c . "\n";
}
$query .= implode(",", $data);
$query .= "\nFROM " . $table->db_table_name . " {$join} {$where} group by {$xCol}";
$db->setQuery($query);
$data = $db->loadObjectList();
$headings = JArrayHelper::toObject(array_keys(JArrayHelper::fromObject($data[0])));
array_unshift($data, $headings);
return $data;
}
开发者ID:nikshade,项目名称:fabrik21,代码行数:30,代码来源:pivot.php
示例4: validate
/**
* validate the elements data against the rule
* @param string data to check
* @param object element Model
* @param int plugin sequence ref
* @return bol true if validation passes, false if fails
*/
function validate($data, &$elementModel, $c)
{
//could be a dropdown with multivalues
if (is_array($data)) {
$data = implode('', $data);
}
$params = $this->getParams();
$element = $elementModel->getElement();
$listModel = $elementModel->getlistModel();
$table = $listModel->getTable();
$db = $listModel->getDb();
$lookuptable = $db->NameQuote($table->db_table_name);
$data = $db->Quote($data);
$query = $db->getQuery(true);
$cond = $params->get('isuniquevalue-caseinsensitive') == 1 ? 'LIKE' : '=';
$query->select('COUNT(*)')->from($lookuptable)->where($element->name . ' ' . $cond . ' ' . $data);
// $$$ hugh - need to check to see if we're editing a record, otherwise
// will fail 'cos it finds the original record (assuming this element hasn't changed)
// @TODO - is there a better way getting the rowid? What if this is form a joined table?
// $rowid = JRequest::getVar('rowid');
// Have to do it by grabbing PK from request, 'cos rowid isn't set on AJAX validation
$pk = FabrikString::safeColNameToArrayKey($table->db_primary_key);
$rowid = JRequest::getVar($pk, '');
if (!empty($rowid)) {
$query->where($table->db_primary_key . ' != ' . $db->Quote($rowid));
}
$db->setQuery($query);
$c = $db->loadResult();
return $c == 0 ? true : false;
}
开发者ID:rhotog,项目名称:fabrik,代码行数:37,代码来源:isuniquevalue.php
示例5: 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::script('media/com_fabrik/js/element.js');
$listModel = JModel::getInstance('list', 'FabrikFEModel');
$listModel->setId(JRequest::getVar('listid'));
$elements = $model->getElements('safecolname');
$pels = $params->get('inline_editable_elements');
$use = json_decode($pels);
if (!is_object($use)) {
$aEls = trim($pels) == '' ? array() : explode(",", $pels);
$use = new stdClass();
foreach ($aEls as $e) {
$use->{$e} = array($e);
}
}
$els = array();
$srcs = array();
$test = (array) $use;
if (!empty($test)) {
foreach ($use as $key => $fields) {
$trigger = $elements[$key];
$els[$key] = new stdClass();
$els[$key]->elid = $trigger->_id;
$els[$key]->plugins = array();
foreach ($fields as $field) {
$val = $elements[$field];
//load in all element js classes
if (is_object($val)) {
$val->formJavascriptClass($srcs);
$els[$key]->plugins[$field] = $val->getElement()->id;
}
}
}
} else {
foreach ($elements as $key => $val) {
$key = FabrikString::safeColNameToArrayKey($key);
$els[$key] = new stdClass();
$els[$key]->elid = $val->_id;
$els[$key]->plugins = array();
$els[$key]->plugins[$key] = $val->getElement()->id;
//load in all element js classes
$val->formJavascriptClass($srcs);
}
}
FabrikHelperHTML::script($srcs);
$opts = $this->getElementJSOptions($model);
$opts->elements = $els;
$opts->formid = $model->getFormModel()->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 = (bool) $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;
}
开发者ID:rhotog,项目名称:fabrik,代码行数:67,代码来源:inlineedit.php
示例6: _process
/**
* Clone the record
*
* @param object $params plugin params
* @param object &$formModel form model
*
* @return bool
*/
private function _process($params, &$formModel)
{
$clone_times_field_id = $params->get('clone_times_field', '');
$clone_batchid_field_id = $params->get('clone_batchid_field', '');
if ($clone_times_field_id != '') {
$elementModel = FabrikWorker::getPluginManager()->getElementPlugin($clone_times_field_id);
$element = $elementModel->getElement(true);
if ($clone_batchid_field_id != '') {
$elementModel = FabrikWorker::getPluginManager()->getElementPlugin($clone_batchid_field_id);
$id_element = $id_elementModel->getElement(true);
$formModel->_formData[$id_element->name] = $formModel->_fullFormData['rowid'];
$formModel->_formData[$id_element->name . '_raw'] = $formModel->_fullFormData['rowid'];
$listModel = $formModel->getlistModel();
$listModel->_oForm = $formModel;
$primaryKey = FabrikString::shortColName($listModel->getTable()->db_primary_key);
$formModel->_formData[$primaryKey] = $formModel->_fullFormData['rowid'];
$formModel->_formData[$primaryKey . '_raw'] = $formModel->_fullFormData['rowid'];
$listModel->storeRow($formModel->_formData, $formModel->_fullFormData['rowid']);
}
// $clone_times_field = $elementModel->getFullName(false, true, false);
$clone_times = $formModel->_formData[$element->name];
if (is_numeric($clone_times)) {
$clone_times = (int) $clone_times;
$formModel->_formData['Copy'] = 1;
for ($x = 1; $x < $clone_times; $x++) {
$formModel->processToDB();
}
return true;
}
}
JError::raiseNotice(JText::_('CLONEERR'), "Couldn't find a valid number of times to clone!");
return true;
}
开发者ID:rogeriocc,项目名称:fabrik,代码行数:41,代码来源:clone.php
示例7: onLoadJavascriptInstance
/**
* Return the javascript to create an instance of the class defined in formJavascriptClass
*
* @param array $args Array [0] => string table's form id to contain plugin
*
* @return bool
*/
public function onLoadJavascriptInstance($args)
{
if (!$this->canUse()) {
return;
}
/** @var FabrikFEModelList $model */
$model = $this->getModel();
$params = $this->getParams();
$orderEl = $model->getFormModel()->getElement($params->get('order_element'), true);
$opts = $this->getElementJSOptions();
$orderElName = FabrikString::safeColNameToArrayKey(FArrayHelper::getValue($model->orderEls, 0, ''));
$opts->enabled = $orderElName == FabrikString::safeColNameToArrayKey($orderEl->getOrderByName()) ? true : false;
$opts->listid = $model->getId();
$opts->orderElementId = $params->get('order_element');
$opts->handle = $params->get('order_element_as_handle', 1) == 1 ? '.' . $orderEl->getOrderByName() : false;
$opts->direction = $opts->enabled ? $model->orderDirs[0] : '';
$opts->transition = '';
$opts->duration = '';
$opts->constrain = '';
$opts->clone = '';
$opts->revert = '';
$opts = json_encode($opts);
$this->jsInstance = "new FbListOrder({$opts})";
return true;
}
开发者ID:jfquestiaux,项目名称:fabrik,代码行数:32,代码来源:order.php
示例8: loadJavascriptInstance
/**
* return the javascript to create an instance of the class defined in formJavascriptClass
* @param object parameters
* @param object table model
* @param array [0] => string table's form id to contain plugin
* @return bool
*/
function loadJavascriptInstance($params, $model, $args)
{
if (!$this->canUse()) {
return;
}
$form_id = $args[0];
FabrikHelperHTML::script('element.js', 'media/com_fabrik/js/');
$orderEl = $model->getForm()->getElement($params->get('order_element'), true);
$opts = new stdClass();
$opts->enabled = count($model->orderEls) === 1 && FabrikString::safeColNameToArrayKey($model->orderEls[0]) == FabrikString::safeColNameToArrayKey($orderEl->getOrderByName()) ? true : false;
$opts->liveSite = COM_FABRIK_LIVESITE;
$opts->tableid = $model->_id;
$opts->orderElementId = $params->get('order_element');
$opts->handle = $params->get('order_element_as_handle', 1) == 1 ? '.fabrik_row___' . $orderEl->getOrderByName() : false;
$opts->direction = $opts->enabled ? $model->orderDirs[0] : '';
$opts->transition = '';
$opts->duration = '';
$opts->constrain = '';
$opts->clone = '';
$opts->revert = '';
$opts->container = 'table_' . $model->getTable()->id;
$opts = json_encode($opts);
$lang = $this->_getLang();
$lang = json_encode($lang);
$this->jsInstance = "new FbTableOrder('{$form_id}', {$opts}, {$lang})";
return true;
}
开发者ID:nikshade,项目名称:fabrik21,代码行数:34,代码来源:order.php
示例9: tagify
/**
* Tagify a string
*
* @param string $data Tagify
*
* @return string Tagified string
*/
protected function tagify($data)
{
$name = $this->getFullName(true, false);
$params = $this->getParams();
$listModel = $this->getlistModel();
$filters = $listModel->getFilterArray();
$fkeys = JArrayHelper::getValue($filters, 'key', array());
$data = explode(",", strip_tags($data));
$tags = array();
$url = $params->get('textarea_tagifyurl');
if ($url == '') {
$url = $_SERVER['REQUEST_URI'];
$bits = explode('?', $url);
$root = JArrayHelper::getValue($bits, 0, '', 'string');
$bits = JArrayHelper::getValue($bits, 1, '', 'string');
$bits = explode("&", $bits);
$fullName = $this->getFullName(true, false);
for ($b = count($bits) - 1; $b >= 0; $b--) {
$parts = explode("=", $bits[$b]);
if (count($parts) > 1) {
$key = FabrikString::ltrimword(FabrikString::safeColNameToArrayKey($parts[0]), '&');
if ($key == $fullName) {
unset($bits[$b]);
}
if ($key == $fullName . '[value]') {
unset($bits[$b]);
}
if ($key == $fullName . '[condition]') {
unset($bits[$b]);
}
}
}
}
$url = $root . '?' . implode('&', $bits);
// $$$ rob 24/02/2011 remove duplicates from tags
$data = array_unique($data);
$img = FabrikWorker::j3() ? 'bookmark.png' : 'tag.png';
$icon = FabrikHelperHTML::image($img, 'form', @$this->tmpl, array('alt' => 'tag'));
foreach ($data as $d) {
$d = trim($d);
if ($d != '') {
if (trim($params->get('textarea_tagifyurl')) == '') {
$qs = strstr($url, '?');
if (substr($url, -1) === '?') {
$thisurl = $url . $name . '[value]=' . $d;
} else {
$thisurl = strstr($url, '?') ? $url . '&' . $name . '[value]=' . urlencode($d) : $url . '?' . $name . '[value]=' . urlencode($d);
}
$thisurl .= '&' . $name . '[condition]=CONTAINS';
$thisurl .= '&resetfilters=1';
} else {
$thisurl = str_replace('{tag}', urlencode($d), $url);
}
$tags[] = '<a href="' . $thisurl . '" class="fabrikTag">' . $icon . $d . '</a>';
}
}
return implode(' ', $tags);
}
开发者ID:ppantilla,项目名称:bbninja,代码行数:65,代码来源:textarea.php
示例10: render
/**
* Internally render the plugin, and add required script declarations
* to the document
*
* @return void
*/
public function render()
{
$params = $this->getParams();
$document = JFactory::getDocument();
$document->addScript("http://api.simile-widgets.org/runway/1.0/runway-api.js");
$c = 0;
$images = (array) $params->get('coverflow_image');
$titles = (array) $params->get('coverflow_title');
$subtitles = (array) $params->get('coverflow_subtitle');
$listIds = (array) $params->get('coverflow_table');
$eventData = array();
foreach ($listIds as $listId) {
$listModel = JModelLegacy::getInstance('List', 'FabrikFEModel');
$listModel->setId($listId);
$list = $listModel->getTable();
$listModel->getPagination(0, 0, 0);
$image = $images[$c];
$title = $titles[$c];
$subtitle = $subtitles[$c];
$data = $listModel->getData();
if ($listModel->canView() || $listModel->canEdit()) {
$elements = $listModel->getElements();
$imageElement = FArrayHelper::getValue($elements, FabrikString::safeColName($image));
foreach ($data as $group) {
if (is_array($group)) {
foreach ($group as $row) {
$event = new stdClass();
if (!method_exists($imageElement, 'getStorage')) {
switch (get_class($imageElement)) {
case 'FabrikModelFabrikImage':
$rootFolder = $imageElement->getParams()->get('selectImage_root_folder');
$rootFolder = JString::ltrim($rootFolder, '/');
$rootFolder = JString::rtrim($rootFolder, '/');
$event->image = COM_FABRIK_LIVESITE . 'images/stories/' . $rootFolder . '/' . $row->{$image . '_raw'};
break;
default:
$event->image = isset($row->{$image . '_raw'}) ? $row->{$image . '_raw'} : '';
break;
}
} else {
$event->image = $imageElement->getStorage()->pathToURL($row->{$image . '_raw'});
}
$event->title = $title === '' ? '' : (string) strip_tags($row->{$title});
$event->subtitle = $subtitle === '' ? '' : (string) strip_tags($row->{$subtitle});
$eventData[] = $event;
}
}
}
}
$c++;
}
$json = json_encode($eventData);
$str = "var coverflow = new FbVisCoverflow({$json});";
$srcs = FabrikHelperHTML::framework();
$srcs['Coverflow'] = $this->srcBase . 'coverflow/coverflow.js';
FabrikHelperHTML::script($srcs, $str);
}
开发者ID:jfquestiaux,项目名称:fabrik,代码行数:63,代码来源:coverflow.php
示例11: getOptions
function getOptions()
{
$db = FabrikWorker::getDbo(true);
$query = $db->getQuery(true);
$query->select("id AS value, label AS " . FabrikString::safeColName('text'));
$query->from("#__{package}_forms");
$query->order("value DESC");
$db->setQuery($query);
$rows = $db->loadObjectList();
return $rows;
}
开发者ID:nickbunyan,项目名称:fabrik,代码行数:11,代码来源:formlist.php
示例12: exists
/**
* Does a file exist
*
* @param string $filepath File path to test
*
* @return bool
*/
public function exists($filepath)
{
if ($filepath == '\\') {
return false;
}
if (JFile::exists($filepath)) {
return true;
}
$filepath = COM_FABRIK_BASE . '/' . FabrikString::ltrimword($filepath, COM_FABRIK_BASE . '/');
return JFile::exists($filepath);
}
开发者ID:LGBGit,项目名称:tierno,代码行数:18,代码来源:filesystemstorage.php
示例13: onAfterProcess
/**
* Run right at the end of the form processing
* form needs to be set to record in database for this to hook to be called
*
* @return bool
*/
public function onAfterProcess()
{
$params = $this->getParams();
$input = $this->app->input;
$formModel = $this->getModel();
if ($params->get('ask-receipt')) {
if (!array_key_exists('fabrik_email_copy', $_POST)) {
return;
}
}
$rowId = $input->get('rowid');
$config = JFactory::getConfig();
$w = new FabrikWorker();
$data = $this->getProcessData();
$message = $params->get('receipt_message');
$editURL = COM_FABRIK_LIVESITE . "index.php?option=com_" . $this->package . "&view=form&fabrik=" . $formModel->get('id') . "&rowid=" . $rowId;
$viewURL = COM_FABRIK_LIVESITE . "index.php?option=com_" . $this->package . "&view=details&fabrik=" . $formModel->get('id') . "&rowid=" . $rowId;
$editLink = "<a href=\"{$editURL}\">" . FText::_('EDIT') . "</a>";
$viewLink = "<a href=\"{$viewURL}\">" . FText::_('VIEW') . "</a>";
$message = str_replace('{fabrik_editlink}', $editLink, $message);
$message = str_replace('{fabrik_viewlink}', $viewLink, $message);
$message = str_replace('{fabrik_editurl}', $editURL, $message);
$message = str_replace('{fabrik_viewurl}', $viewURL, $message);
$message = $w->parseMessageForPlaceHolder($message, $data, false);
$to = $w->parseMessageForPlaceHolder($params->get('receipt_to'), $data, false);
$to = FabrikString::stripSpace($to);
if (empty($to)) {
/* $$$ hugh - not much point trying to send if we don't have a To address
* (happens frequently if folk don't properly validate their form inputs and are using placeholders)
* @TODO - might want to add some feedback about email not being sent
*/
return;
}
$to = explode(',', $to);
$subject = html_entity_decode($params->get('receipt_subject', ''));
$subject = JText::_($w->parseMessageForPlaceHolder($subject, $data, false));
$from = $config->get('mailfrom', '');
$fromName = $config->get('fromname', '');
// Darn silly hack for poor joomfish settings where lang parameters are set to override joomla global config but not mail translations entered
$rawConfig = new JConfig();
if ($from === '') {
$from = $rawConfig->mailfrom;
}
if ($fromName === '') {
$fromName = $rawConfig->fromname;
}
$from = $params->get('from_email', $from);
$res = FabrikWorker::sendMail($from, $fromName, $to, $subject, $message, true);
if (!$res) {
throw new RuntimeException('Couldn\'t send receipt', 500);
}
}
开发者ID:glauberm,项目名称:cinevi,代码行数:58,代码来源:receipt.php
示例14: exists
/**
* Does a file exist
*
* @param string $filepath File path to test
* @param bool $prependRoot also test with root prepended
*
* @return bool
*/
public function exists($filepath, $prependRoot = true)
{
if (empty($filepath) || $filepath == '\\') {
return false;
}
if (JFile::exists($filepath)) {
return true;
}
if ($prependRoot) {
$filepath = COM_FABRIK_BASE . '/' . FabrikString::ltrimword($filepath, COM_FABRIK_BASE . '/');
return JFile::exists($filepath);
}
return false;
}
开发者ID:glauberm,项目名称:cinevi,代码行数:22,代码来源:filesystemstorage.php
示例15: filterValueList_Exact
/**
* (non-PHPdoc)
* @see components/com_fabrik/models/FabrikModelElement::_buildFilterJoin()
*/
protected function filterValueList_Exact($normal, $tableName = '', $label = '', $id = '', $incjoin = true)
{
$tableModel = $this->getTableModel();
$fabrikDb =& $tableModel->getDb();
$table =& $tableModel->getTable();
$elName2 = $this->getFullName(false, false, false);
$ids = $tableModel->getColumnData($elName2);
$elName = FabrikString::safeColName($this->getFullName(false, true, false));
$sql = 'SELECT name AS ' . $fabrikDb->nameQuote('text') . ', id AS ' . $fabrikDb->nameQuote('value') . ' from #__core_acl_aro_groups ' . "WHERE id IN ('" . implode("','", $ids) . "')";
$fabrikDb->setQuery($sql);
$rows = $fabrikDb->loadObjectList();
$this->nameMap($rows);
return $rows;
}
开发者ID:nikshade,项目名称:fabrik21,代码行数:18,代码来源:fabrikaccess.php
示例16: getOptions
/**
* Get list options
*
* @return array
*/
protected function getOptions()
{
$db = FabrikWorker::getDbo();
$query = $db->getQuery(true);
$query->select("id AS value, CONCAT(label, '(', version , ')') AS " . FabrikString::safeColName(text));
$query->from('#__{package}_packages');
$query->order('value DESC');
$db->setQuery($query);
$rows = $db->loadObjectList();
$o = new stdClass();
$o->value = 0;
$o->text = JText::_('COM_FABRIK_NO_PACKAGE');
array_unshift($rows, $o);
return $rows;
}
开发者ID:rogeriocc,项目名称:fabrik,代码行数:20,代码来源:packagelist.php
示例17: onCanSelectRow
function onCanSelectRow($params, $tableModel, $row)
{
// If $row is null, we were called from the table's canEdit() in a per-table rather than per-row context,
// and we don't have an opinion on per-table edit permissions, so just return true.
if (!is_object($row[0])) {
return true;
}
$field = $params->get('canselectrow_field');
$field = FabrikString::safeColnameToArrayKey($field);
// $$$ rob if no can edit field selected in admin return true
if (trim($field) == '') {
return true;
}
$value = $params->get('canselectrow_value');
return $row[0]->{$field} == $value;
}
开发者ID:nikshade,项目名称:fabrik21,代码行数:16,代码来源:canselectrow.php
示例18: _strToCoords
function _strToCoords($v, $zoomlevel = 0)
{
$o = new stdClass();
$o->coords = array('', '');
$o->zoomlevel = (int) $zoomlevel;
if (strstr($v, ",")) {
$ar = explode(":", $v);
$o->zoomlevel = count($ar) == 2 ? array_pop($ar) : 4;
$v = FabrikString::ltrimword($ar[0], "(");
$v = rtrim($v, ")");
$o->coords = explode(",", $v);
} else {
$o->coords = array(0, 0);
}
return $o;
}
开发者ID:nikshade,项目名称:fabrik21,代码行数:16,代码来源:fabrikweather.php
示例19: tagify
/**
* tagify a string
* @param string to tagify
* @return string tagified string
*/
protected function tagify($data)
{
$name = $this->getFullName(false, true, false);
$params = $this->getParams();
$listModel = $this->getlistModel();
$filters = $listModel->getFilterArray();
$fkeys = JArrayHelper::getValue($filters, 'key', array());
$data = explode(",", strip_tags($data));
$tags = array();
$url = $params->get('textarea_tagifyurl');
if ($url == '') {
$url = $_SERVER['REQUEST_URI'];
$bits = explode('?', $url);
$bits = JArrayHelper::getValue($bits, 1, '', 'string');
$bits = explode("&", $bits);
foreach ($bits as $bit) {
$parts = explode("=", $bit);
if (count($parts) > 1) {
$key = FabrikString::ltrimword(FabrikString::safeColNameToArrayKey($parts[0]), '&');
if ($key == $this->getFullName(false, true, false)) {
$url = str_replace($key . '=' . $parts[1], '', $url);
}
}
}
}
// $$$ rbo 24/02/2011 remove duplicates from tags
$data = array_unique($data);
$icon = FabrikHelperHTML::image('tag.png', 'form', @$this->tmpl, array('alt' => 'tag'));
foreach ($data as $d) {
$d = trim($d);
if ($d != '') {
if (trim($params->get('textarea_tagifyurl')) == '') {
$qs = strstr($url, '?');
if (substr($url, -1) === '?') {
$thisurl = "{$url}{$name}={$d}";
} else {
$thisurl = strstr($url, '?') ? "{$url}&{$name}=" . urlencode($d) : "{$url}?{$name}=" . urlencode($d);
}
} else {
$thisurl = str_replace('{tag}', urlencode($d), $url);
}
$tags[] = '<a href="' . $thisurl . '" class="fabrikTag">' . $icon . $d . '</a>';
}
}
return implode(" ", $tags);
}
开发者ID:romuland,项目名称:khparts,代码行数:51,代码来源:textarea.php
示例20: validate
/**
* validate the elements data against the rule
* @param string data to check
* @param object element Model
* @param int plugin sequence ref
* @param int repeat group count
* @return bol true if validation passes, false if fails
*/
function validate($data, &$elementModel, $c, $repeat_count = 0)
{
//could be a dropdown with multivalues
if (is_array($data)) {
$data = implode('', $data);
}
$params =& $this->getParams();
$element =& $elementModel->getElement();
$tableModel =& $elementModel->getTableModel();
$table =& $tableModel->getTable();
$db =& $tableModel->getDb();
$lookuptable = $db->nameQuote($table->db_table_name);
$data = $db->Quote($data);
if ($params->get('isuniquevalue-caseinsensitive') == 1) {
$sql = "SELECT COUNT(*) FROM {$lookuptable} WHERE {$element->name} LIKE {$data}";
} else {
$sql = "SELECT COUNT(*) FROM {$lookuptable} WHERE {$element->name} = {$data}";
}
// $$$ hugh - need to check to see if we're editing a record, otherwise
// will fail 'cos it finds the original record (assuming this element hasn't changed)
// @TODO - is there a better way getting the rowid? What if this is form a joined table?
// $rowid = JRequest::getVar('rowid');
// Have to do it by grabbing PK from request, 'cos rowid isn't set on AJAX validation
$pk = FabrikString::safeColNameToArrayKey($table->db_primary_key);
$rowid = JRequest::getVar($pk, '');
if (!empty($rowid)) {
//if main key is in repeat group!
if (is_array($rowid)) {
foreach ($rowid as &$i) {
$i = $db->Quote($i);
}
$s = implode(',', $rowid);
if ($s !== "''") {
$sql .= " AND {$table->db_primary_key} NOT IN (" . $s . ")";
}
} else {
$sql .= " AND {$table->db_primary_key} != " . $db->Quote($rowid);
}
}
$db->setQuery($sql);
$c = $db->loadResult();
return $c == 0 ? true : false;
}
开发者ID:nikshade,项目名称:fabrik21,代码行数:51,代码来源:isuniquevalue.php
注:本文中的FabrikString类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论