当前位置: 首页>>代码示例>>PHP>>正文


PHP RSFormProHelper::getDirectoryFields方法代码示例

本文整理汇总了PHP中RSFormProHelper::getDirectoryFields方法的典型用法代码示例。如果您正苦于以下问题:PHP RSFormProHelper::getDirectoryFields方法的具体用法?PHP RSFormProHelper::getDirectoryFields怎么用?PHP RSFormProHelper::getDirectoryFields使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在RSFormProHelper的用法示例。


在下文中一共展示了RSFormProHelper::getDirectoryFields方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: display

 public function display($tpl = null)
 {
     // set title
     JToolBarHelper::title('RSForm! Pro', 'rsform');
     // adding the toolbar on 2.5
     if (!RSFormProHelper::isJ('3.0')) {
         $this->addToolbar();
     }
     $layout = strtolower($this->getLayout());
     if ($layout == 'edit') {
         JToolBarHelper::apply('directory.apply');
         JToolBarHelper::save('directory.save');
         JToolBarHelper::cancel('directory.cancel');
         $backIcon = RSFormProHelper::isJ('3.0') ? 'previous' : 'back';
         JToolBarHelper::custom('directory.cancelform', $backIcon, $backIcon, JText::_('RSFP_BACK_TO_FORM'), false);
         RSFormProHelper::loadCodeMirror();
         $this->directory = $this->get('Directory');
         $this->formId = JRequest::getInt('formId', 0);
         $this->tab = JRequest::getInt('tab', 0);
         $this->emails = $this->get('emails');
         $this->fields = RSFormProHelper::getDirectoryFields($this->formId);
         $this->quickfields = $this->get('QuickFields');
         $lists['ViewLayoutAutogenerate'] = RSFormProHelper::renderHTML('select.booleanlist', 'jform[ViewLayoutAutogenerate]', 'onclick="changeDirectoryAutoGenerateLayout(' . $this->formId . ', this.value);"', $this->directory->ViewLayoutAutogenerate);
         $lists['enablepdf'] = RSFormProHelper::renderHTML('select.booleanlist', 'jform[enablepdf]', '', $this->directory->enablepdf);
         $lists['enablecsv'] = RSFormProHelper::renderHTML('select.booleanlist', 'jform[enablecsv]', '', $this->directory->enablecsv);
         $this->lists = $lists;
     } elseif ($layout == 'edit_emails') {
         $this->emails = $this->get('emails');
     } else {
         $this->addToolbar();
         JToolBarHelper::title(JText::_('RSFP_SUBM_DIR'), 'rsform');
         JToolbarHelper::deleteList('', 'directory.remove');
         $this->sidebar = $this->get('Sidebar');
         $this->forms = $this->get('forms');
         $this->pagination = $this->get('pagination');
         $this->sortColumn = $this->get('sortColumn');
         $this->sortOrder = $this->get('sortOrder');
     }
     parent::display($tpl);
 }
开发者ID:knigherrant,项目名称:decopatio,代码行数:40,代码来源:view.html.php

示例2: getImagesFields

 public function getImagesFields()
 {
     $cids = array();
     $query = $this->_db->getQuery(true);
     $formId = JRequest::getInt('formId');
     $fields = RSFormProHelper::getDirectoryFields($formId);
     if (!empty($fields)) {
         foreach ($fields as $field) {
             if ($field->indetails) {
                 $cids[] = $field->componentId;
             }
         }
     }
     JArrayHelper::toInteger($cids);
     if (!empty($cids)) {
         $query->clear()->select($this->_db->qn('p.PropertyValue'))->from($this->_db->qn('#__rsform_properties', 'p'))->join('LEFT', $this->_db->qn('#__rsform_components', 'c') . ' ON ' . $this->_db->qn('p.ComponentId') . ' = ' . $this->_db->qn('c.ComponentId'))->join('LEFT', $this->_db->qn('#__rsform_directory_fields', 'd') . ' ON ' . $this->_db->qn('d.ComponentId') . ' = ' . $this->_db->qn('c.ComponentId'))->where($this->_db->qn('c.FormId') . ' = ' . (int) $formId)->where($this->_db->qn('p.PropertyName') . ' = ' . $this->_db->q('NAME'))->where($this->_db->qn('c.ComponentId') . ' IN (' . implode(',', $cids) . ')')->where($this->_db->qn('c.ComponentTypeId') . ' = 9')->where($this->_db->qn('c.Published') . ' = 1')->order($this->_db->qn('d.ordering'));
         $this->_db->setQuery($query);
         return $this->_db->loadColumn();
     }
     return array();
 }
开发者ID:AlexanderKri,项目名称:joom-upd,代码行数:21,代码来源:directory.php

示例3: getEditFields

 public static function getEditFields($cid)
 {
     $db = JFactory::getDbo();
     $return = array();
     $values = JFactory::getApplication()->input->get('form', array(), 'array');
     $pattern = '#\\[p(.*?)\\]#is';
     $db->setQuery("SELECT * FROM #__rsform_submissions WHERE SubmissionId='" . (int) $cid . "'");
     $submission = $db->loadObject();
     if (empty($submission)) {
         $mainframe = JFactory::getApplication();
         $mainframe->redirect(JURI::root());
         return $return;
     }
     $validation = !empty($values) ? RSFormProHelper::validateForm($submission->FormId, 'directory') : array();
     $formFields = RSFormProHelper::getDirectoryFields($submission->FormId);
     $editable = array();
     foreach ($formFields as $formField) {
         if ($formField->editable) {
             $editable[] = $formField->FieldName;
         }
     }
     $db->setQuery("SELECT FieldName, FieldValue FROM #__rsform_submission_values WHERE SubmissionId='" . (int) $cid . "'");
     $fields = $db->loadObjectList();
     foreach ($fields as $field) {
         $submission->values[$field->FieldName] = $field->FieldValue;
     }
     unset($fields);
     $db->setQuery("SELECT p.PropertyValue, ct.ComponentTypeName, c.ComponentId FROM #__rsform_components c LEFT JOIN #__rsform_properties p ON (p.ComponentId=c.ComponentId) LEFT JOIN #__rsform_component_types ct ON (c.ComponentTypeId=ct.ComponentTypeId) WHERE c.FormId='" . $submission->FormId . "' AND c.Published='1' AND p.PropertyName='NAME' ORDER BY `Order`");
     $fields = $db->loadObjectList();
     if (empty($fields)) {
         return $return;
     }
     $componentIds = array();
     foreach ($fields as $field) {
         $componentIds[] = $field->ComponentId;
     }
     $properties = RSFormProHelper::getComponentProperties($componentIds);
     $fields = RSFormProHelper::sortFields($fields, $editable);
     foreach ($fields as $field) {
         if (!in_array($field->PropertyValue, $editable)) {
             continue;
         }
         $invalid = !empty($validation) && in_array($field->ComponentId, $validation) ? ' rsform-error' : '';
         $data = $properties[$field->ComponentId];
         $new_field = array();
         $new_field[0] = !empty($data['CAPTION']) ? $data['CAPTION'] : $field->PropertyValue;
         $new_field[2] = isset($data['REQUIRED']) && $data['REQUIRED'] == 'YES' ? '<strong class="formRequired">(*)</strong>' : '';
         $new_field[3] = $field->PropertyValue;
         $name = $field->PropertyValue;
         if (isset($values[$field->PropertyValue])) {
             $value = $values[$field->PropertyValue];
         } else {
             $value = isset($submission->values[$field->PropertyValue]) ? $submission->values[$field->PropertyValue] : '';
         }
         if ($data['NAME'] == 'RSEProPayment') {
             $field->ComponentTypeName = 'rsepropayment';
         }
         switch ($field->ComponentTypeName) {
             // skip this field for now, no need to edit it
             case 'freeText':
                 continue 2;
                 break;
             default:
                 if (strpos($value, "\n") !== false || strpos($value, "\r") !== false) {
                     $new_field[1] = '<textarea style="width: 95%" class="rs_textarea' . $invalid . '" rows="10" cols="60" name="form[' . $name . ']">' . RSFormProHelper::htmlEscape($value) . '</textarea>';
                 } else {
                     $new_field[1] = '<input class="rs_inp rs_80' . $invalid . '" type="text" name="form[' . $name . ']" value="' . RSFormProHelper::htmlEscape($value) . '" />';
                 }
                 break;
             case 'textArea':
                 if (isset($data['WYSIWYG']) && $data['WYSIWYG'] == 'YES') {
                     $new_field[1] = RSFormProHelper::WYSIWYG('form[' . $name . ']', RSFormProHelper::htmlEscape($value), '', 600, 100, 60, 10);
                 } else {
                     $new_field[1] = '<textarea style="width: 95%" class="rs_textarea' . $invalid . '" rows="10" cols="60" name="form[' . $name . ']">' . RSFormProHelper::htmlEscape($value) . '</textarea>';
                 }
                 break;
             case 'radioGroup':
             case 'checkboxGroup':
             case 'selectList':
                 if ($field->ComponentTypeName == 'radioGroup') {
                     $data['SIZE'] = 0;
                     $data['MULTIPLE'] = 'NO';
                 } elseif ($field->ComponentTypeName == 'checkboxGroup') {
                     $data['SIZE'] = 5;
                     $data['MULTIPLE'] = 'YES';
                 }
                 $value = !empty($values) ? $value : RSFormProHelper::explode($value);
                 $items = RSFormProHelper::isCode($data['ITEMS']);
                 $items = RSFormProHelper::explode($items);
                 $options = array();
                 foreach ($items as $item) {
                     if (preg_match($pattern, $item, $match)) {
                         $item = preg_replace($pattern, '', $item);
                     }
                     // <OPTGROUP>
                     if (preg_match('/\\[g\\]/', $item)) {
                         $item = str_replace('[g]', '', $item);
                         $optgroup = new stdClass();
                         $optgroup->value = '<OPTGROUP>';
                         $optgroup->text = $item;
//.........这里部分代码省略.........
开发者ID:renekreijveld,项目名称:rsformpro-bootstrapped,代码行数:101,代码来源:rsform.php

示例4: download

 public function download()
 {
     $app = JFactory::getApplication();
     $model = $this->getModel('directory');
     $directory = $model->getDirectory();
     if (!$directory->enablecsv) {
         JError::raiseWarning(500, JText::_('RSFP_VIEW_DIRECTORY_NO_CSV'));
         return $app->redirect(JURI::root());
     }
     if (!$model->isValid()) {
         JError::raiseWarning(500, $model->getError());
         return $app->redirect(JURI::root());
     }
     $db = JFactory::getDbo();
     $params = $app->getParams('com_rsform');
     $menu = $app->getMenu();
     $active = $menu->getActive();
     $formId = $params->get('formId');
     $cids = JRequest::getVar('cid');
     JArrayHelper::toInteger($cids);
     $fields = RSFormProHelper::getDirectoryFields($formId);
     $headers = RSFormProHelper::getDirectoryStaticHeaders();
     $downloadableFields = array();
     $downloadableFieldCaptions = array();
     foreach ($fields as $field) {
         if ($field->incsv) {
             $downloadableFields[] = (object) array('name' => $field->FieldName, 'static' => $field->componentId < 0 && isset($headers[$field->componentId]) ? 1 : 0);
             $downloadableFieldCaptions[] = $field->FieldCaption;
         }
     }
     list($multipleSeparator, $uploadFields, $multipleFields, $secret) = RSFormProHelper::getDirectoryFormProperties($formId);
     // Get submissions
     $db->setQuery("SELECT * FROM #__rsform_submissions WHERE FormId='" . (int) $formId . "' AND SubmissionId IN (" . implode(',', $cids) . ")");
     $submissions = $db->loadObjectList('SubmissionId');
     // Get values
     $names = array();
     foreach ($downloadableFields as $field) {
         if (!$field->static) {
             $names[] = $db->q($field->name);
         }
     }
     $query = $db->getQuery(true);
     $query->select($db->qn('SubmissionId'))->select($db->qn('FieldName'))->select($db->qn('FieldValue'))->from($db->qn('#__rsform_submission_values'))->where($db->qn('FormId') . '=' . $db->q($formId));
     if ($cids) {
         $query->where($db->qn('SubmissionId') . ' IN (' . implode(',', $cids) . ')');
     }
     if ($names) {
         $query->where($db->qn('FieldName') . ' IN (' . implode(',', $names) . ')');
     }
     $db->setQuery($query);
     $values = $db->loadObjectList();
     // Combine them
     foreach ($values as $item) {
         if (!isset($submissions[$item->SubmissionId]->values)) {
             $submissions[$item->SubmissionId]->values = array();
         }
         // process here
         if (in_array($item->FieldName, $uploadFields)) {
             $item->FieldValue = '<a href="' . JURI::root() . 'index.php?option=com_rsform&amp;task=submissions.view.file&amp;hash=' . md5($item->SubmissionId . $secret . $item->FieldName) . '">' . basename($item->FieldValue) . '</a>';
         } elseif (in_array($item->FieldName, $multipleFields)) {
             $item->FieldValue = str_replace("\n", $multipleSeparator, $item->FieldValue);
         }
         $submissions[$item->SubmissionId]->values[$item->FieldName] = $item->FieldValue;
     }
     $enclosure = '"';
     $delimiter = ',';
     $download_name = $active->alias . '.csv';
     header('Cache-Control: public, must-revalidate');
     header('Cache-Control: pre-check=0, post-check=0, max-age=0');
     if (!preg_match('#MSIE#', $_SERVER['HTTP_USER_AGENT'])) {
         header("Pragma: no-cache");
     }
     header("Expires: 0");
     header("Content-Description: File Transfer");
     header("Expires: Sat, 01 Jan 2000 01:00:00 GMT");
     if (preg_match('#Opera#', $_SERVER['HTTP_USER_AGENT'])) {
         header("Content-Type: application/octetstream");
     } else {
         header("Content-Type: application/octet-stream");
     }
     header('Content-Disposition: attachment; filename="' . $download_name . '"');
     header("Content-Transfer-Encoding: binary\n");
     ob_end_clean();
     echo $enclosure . implode($enclosure . $delimiter . $enclosure, $downloadableFieldCaptions) . $enclosure . "\n";
     foreach ($cids as $cid) {
         $row = array();
         foreach ($downloadableFields as $field) {
             $value = '';
             if (!$field->static && isset($submissions[$cid]->values[$field->name])) {
                 $value = $submissions[$cid]->values[$field->name];
             } elseif ($field->static && isset($submissions[$cid]->{$field->name})) {
                 // Show a text for the "confirmed" column.
                 if ($field->name == 'confirmed') {
                     $value = $submissions[$cid]->{$field->name} ? JText::_('RSFP_YES') : JText::_('RSFP_NO');
                 } else {
                     $value = $submissions[$cid]->{$field->name};
                 }
             }
             $row[] = $value;
         }
//.........这里部分代码省略.........
开发者ID:knigherrant,项目名称:decopatio,代码行数:101,代码来源:directory.php

示例5: save

 public function save()
 {
     jimport('joomla.filesystem.file');
     jimport('joomla.filesystem.folder');
     $cid = JRequest::getInt('id');
     $form = JRequest::getVar('form', array(), 'post', 'none', JREQUEST_ALLOWRAW);
     $static = JRequest::getVar('formStatic', array(), 'post', 'none', JREQUEST_ALLOWRAW);
     $formId = JRequest::getInt('formId');
     $files = JRequest::getVar('form', array(), 'files', 'none', JREQUEST_ALLOWRAW);
     $validation = RSFormProHelper::validateForm($formId, 'directory', $cid);
     if (!empty($validation)) {
         return false;
     }
     $formFields = RSFormProHelper::getDirectoryFields($formId);
     $headers = RSFormProHelper::getDirectoryStaticHeaders();
     $staticFields = array();
     $allowed = array();
     foreach ($formFields as $field) {
         if ($field->editable) {
             if ($field->componentId < 0 && isset($headers[$field->componentId])) {
                 $staticFields[] = $field->FieldName;
             } else {
                 $allowed[] = $field->FieldName;
             }
         }
     }
     //Trigger Event - onBeforeDirectorySave
     $this->_app->triggerEvent('rsfp_f_onBeforeDirectorySave', array(array('SubmissionId' => &$cid, 'formId' => $formId, 'post' => &$form)));
     // Handle file uploads first
     if (!empty($files['error'])) {
         foreach ($files['error'] as $field => $error) {
             if (!in_array($field, $allowed) || $error) {
                 continue;
             }
             // The above $validation should suffice
             $this->_db->setQuery("SELECT FieldValue FROM #__rsform_submission_values WHERE FieldName='" . $this->_db->escape($field) . "' AND SubmissionId='" . $cid . "' LIMIT 1");
             $original = $this->_db->loadResult();
             // Prefix
             $componentId = RSFormProHelper::getComponentId($field, $formId);
             $data = RSFormProHelper::getComponentProperties($componentId);
             $prefix = uniqid('') . '-';
             if (isset($data['PREFIX']) && strlen(trim($data['PREFIX'])) > 0) {
                 $prefix = RSFormProHelper::isCode($data['PREFIX']);
             }
             // Path
             $realpath = realpath($data['DESTINATION'] . DIRECTORY_SEPARATOR);
             if (substr($realpath, -1) != DIRECTORY_SEPARATOR) {
                 $realpath .= DIRECTORY_SEPARATOR;
             }
             // Filename
             $file = $realpath . $prefix . $files['name'][$field];
             // Upload File
             if (JFile::upload($files['tmp_name'][$field], $file) && $file != $original) {
                 // Remove the original file to save up space
                 if (file_exists($original) && is_file($original)) {
                     JFile::delete($original);
                 }
                 // Add to db (submission value)
                 $form[$field] = $file;
             }
         }
     }
     // Update fields
     foreach ($form as $field => $value) {
         if (!in_array($field, $allowed)) {
             continue;
         }
         if (is_array($value)) {
             $value = implode("\n", $value);
         }
         // Dynamic field - update value.
         $this->_db->setQuery("SELECT SubmissionValueId, FieldValue FROM #__rsform_submission_values WHERE FieldName='" . $this->_db->escape($field) . "' AND SubmissionId='" . $cid . "' LIMIT 1");
         $original = $this->_db->loadObject();
         if (!$original) {
             $this->_db->setQuery("INSERT INTO #__rsform_submission_values SET FormId='" . $formId . "', SubmissionId='" . $cid . "', FieldName='" . $this->_db->escape($field) . "', FieldValue='" . $this->_db->escape($value) . "'");
             $this->_db->execute();
         } else {
             // Update only if we've changed something
             if ($original->FieldValue != $value) {
                 $this->_db->setQuery("UPDATE #__rsform_submission_values SET FieldValue='" . $this->_db->escape($value) . "' WHERE SubmissionValueId='" . $original->SubmissionValueId . "' LIMIT 1");
                 $this->_db->execute();
             }
         }
     }
     $offset = JFactory::getConfig()->get('offset');
     if ($static && $staticFields) {
         // Static, update submission
         $query = $this->_db->getQuery(true);
         $query->update('#__rsform_submissions')->where($this->_db->qn('SubmissionId') . '=' . $this->_db->q($cid));
         foreach ($staticFields as $field) {
             if (!isset($static[$field])) {
                 $static[$field] = '';
             }
             if ($field == 'DateSubmitted') {
                 $static[$field] = JFactory::getDate($static[$field], $offset)->toSql();
             }
             $query->set($this->_db->qn($field) . '=' . $this->_db->q($static[$field]));
         }
         $this->_db->setQuery($query);
         $this->_db->execute();
//.........这里部分代码省略.........
开发者ID:knigherrant,项目名称:decopatio,代码行数:101,代码来源:directory.php


注:本文中的RSFormProHelper::getDirectoryFields方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。