本文整理汇总了PHP中JUDownloadHelper类的典型用法代码示例。如果您正苦于以下问题:PHP JUDownloadHelper类的具体用法?PHP JUDownloadHelper怎么用?PHP JUDownloadHelper使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了JUDownloadHelper类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getInput
protected function getInput()
{
$html = '';
$db = JFactory::getDbo();
$options = JUDownloadHelper::getFieldGroupOptions();
if ($this->element['usenone'] == 'true') {
array_unshift($options, array('value' => '0', 'text' => JText::_('COM_JUDOWNLOAD_NONE')));
}
if ($this->element['useinherit'] == 'true') {
$appendInherit = "";
if ($this->form->getValue("id")) {
$appendInherit = " ( " . JText::_('COM_JUDOWNLOAD_NONE') . " )";
if ($this->form->getValue("id") > 0) {
$catObj = JUDownloadHelper::getCategoryById($this->form->getValue("parent_id"));
if ($catObj->fieldgroup_id > 1) {
$query = "SELECT name, published FROM #__judownload_fields_groups WHERE id = " . (int) $catObj->fieldgroup_id . " AND id != 1";
$db->setQuery($query);
$fieldgroup = $db->loadObject();
$groupName = $fieldgroup->published != 1 ? "[" . $fieldgroup->name . "]" : $fieldgroup->name;
$appendInherit = "( " . $groupName . " )";
}
}
}
array_unshift($options, array('value' => '-1', 'text' => JText::_('COM_JUDOWNLOAD_INHERIT') . $appendInherit));
} else {
array_unshift($options, array('value' => '', 'text' => JText::_('COM_JUDOWNLOAD_SELECT_FIELD_GROUP')));
}
$required_class = $this->element['required'] == 'true' ? 'required' : '';
$attributes = "class=\"inputbox {$required_class}\"";
$html .= JHtml::_('select.genericlist', $options, $this->name, $attributes, 'value', 'text', $this->value, $this->id);
return $html;
}
示例2: display
public function display($tpl = null)
{
if (count($errors = $this->get('Errors'))) {
JError::raiseError(500, implode('<br />', $errors));
return false;
}
$this->items = $this->get('Items');
$this->pagination = $this->get('Pagination');
$this->state = $this->get('State');
$this->canDo = JUDownloadHelper::getActions('com_judownload');
$this->addToolBar();
if (JUDownloadHelper::isJoomla3x()) {
$this->filterForm = $this->get('FilterForm');
$this->activeFilters = $this->get('ActiveFilters');
}
$options = array();
$options[] = JHtml::_('select.option', '1', JText::_('J1'));
$options[] = JHtml::_('select.option', '2', JText::_('J2'));
$options[] = JHtml::_('select.option', '3', JText::_('J3'));
$options[] = JHtml::_('select.option', '4', JText::_('J4'));
$options[] = JHtml::_('select.option', '5', JText::_('J5'));
$options[] = JHtml::_('select.option', '6', JText::_('J6'));
$options[] = JHtml::_('select.option', '7', JText::_('J7'));
$options[] = JHtml::_('select.option', '8', JText::_('J8'));
$options[] = JHtml::_('select.option', '9', JText::_('J9'));
$options[] = JHtml::_('select.option', '10', JText::_('J10'));
$this->f_levels = $options;
$optionsPublished = array();
$optionsPublished[] = JHtml::_('select.option', '1', JText::_('COM_JUDOWNLOAD_PUBLISHED'));
$optionsPublished[] = JHtml::_('select.option', '0', JText::_('COM_JUDOWNLOAD_UNPUBLISHED'));
$this->published_options = $optionsPublished;
parent::display($tpl);
$this->setDocument();
}
示例3: display
public function display($tpl = null)
{
$this->items = $this->get('Items');
$this->state = $this->get('State');
$this->pagination = $this->get('Pagination');
$this->params = JUDownloadHelper::getParams();
if (count($errors = $this->get('Errors')))
{
JError::raiseError(500, implode("\n", $errors));
return false;
}
$this->listOrder = $this->escape($this->state->get('list.ordering', 'tag.title'));
$this->listDirn = $this->escape($this->state->get('list.direction', 'DESC'));
$this->order_name_array = array(
'tag.id' => JText::_('COM_JUDOWNLOAD_FIELD_ID'),
'tag.title' => JText::_('COM_JUDOWNLOAD_FIELD_TITLE'),
'tag.created' => JText::_('COM_JUDOWNLOAD_FIELD_CREATED'),
'tag.ordering' => JText::_('COM_JUDOWNLOAD_FIELD_ORDERING')
);
$this->order_dir_array = array('ASC' => JText::_('COM_JUDOWNLOAD_ASC'),
'DESC' => JText::_('COM_JUDOWNLOAD_DESC'));
$this->_prepareDocument();
$this->_setBreadcrumb();
parent::display($tpl);
}
示例4: addToolBar
protected function addToolBar()
{
$app = JFactory::getApplication();
$app->input->set('hidemainmenu', true);
$isNew = $this->item->id == 0;
$canDo = JUDownloadHelper::getActions('com_judownload');
$user = JFactory::getUser();
$userId = $user->id;
$checkedOut = !($this->item->checked_out == 0 || $this->item->checked_out == $userId);
JToolBarHelper::title(JText::_('COM_JUDOWNLOAD_PAGE_' . ($checkedOut ? 'VIEW_TEMPLATE_STYLE' : ($isNew ? 'ADD_TEMPLATE_STYLE' : 'EDIT_TEMPLATE_STYLE'))), 'style-add');
if ($isNew) {
if ($canDo->get('core.create')) {
JToolBarHelper::apply('style.apply', 'JTOOLBAR_APPLY');
JToolBarHelper::save('style.save2new', 'JTOOLBAR_SAVE_AND_NEW');
JToolBarHelper::save('style.save', 'JTOOLBAR_SAVE');
}
JToolBarHelper::cancel('style.cancel', 'JTOOLBAR_CANCEL');
} else {
if ($canDo->get('core.edit')) {
JToolBarHelper::apply('style.apply', 'JTOOLBAR_APPLY');
if ($canDo->get('core.create')) {
JToolBarHelper::save('style.save2new', 'JTOOLBAR_SAVE_AND_NEW');
}
JToolBarHelper::save('style.save', 'JTOOLBAR_SAVE');
}
JToolBarHelper::cancel('style.cancel', 'JTOOLBAR_CLOSE');
}
JToolBarHelper::divider();
$bar = JToolBar::getInstance('toolbar');
$bar->addButtonPath(JPATH_ADMINISTRATOR . "/components/com_judownload/helpers/button");
$bar->appendButton('JUHelp', 'help', JText::_('JTOOLBAR_HELP'));
}
示例5: __set
public function __set($name, $value)
{
switch ($name) {
case 'height':
case 'width':
case 'assetField':
case 'authorField':
case 'asset':
$this->{$name} = (string) $value;
break;
case 'buttons':
$value = (string) $value;
if ($value == 'true' || $value == 'yes' || $value == '1') {
$this->buttons = true;
} elseif ($value == 'false' || $value == 'no' || $value == '0') {
$this->buttons = false;
} else {
$this->buttons = explode(',', $value);
}
break;
case 'hide':
$value = (string) $value;
$this->hide = $value ? explode(',', $value) : array();
break;
case 'editorType':
$this->editorType = explode('|', trim((string) $value));
break;
default:
if (JUDownloadHelper::isJoomla3x()) {
parent::__set($name, $value);
} else {
$this->{$name} = $value;
}
}
}
示例6: populateState
protected function populateState($ordering = null, $direction = null)
{
$search = $this->getUserStateFromRequest($this->context . '.filter.search', 'filter_search', '');
$this->setState('filter.search', $search);
$featured = $this->getUserStateFromRequest($this->context . '.filter.featured', 'filter_featured', '');
$this->setState('filter.featured', $featured);
$categoryId = $this->getUserStateFromRequest($this->context . '.filter.category_id', 'filter_catid', '');
$this->setState('filter.catid', $categoryId);
$license = $this->getUserStateFromRequest($this->context . '.filter.license', 'filter_licenseid', '');
$this->setState('filter.licenseid', $license);
$params = JUDownloadHelper::getParams();
$this->setState('params', $params);
parent::populateState('d.title', 'asc');
$field_display = $this->getUserStateFromRequest($this->context . '.field_display', 'field_display', array());
$this->setState('field_display', $field_display);
}
示例7: rebuildCommentTree
public function rebuildCommentTree()
{
$model = $this->getModel();
JUDownloadHelper::obCleanData();
echo $model->rebuildCommentTree();
exit;
}
示例8: changeTemplateId
public function changeTemplateId()
{
$app = JFactory::getApplication();
$jInput = $app->input;
$templateId = $jInput->post->getInt("value");
$db = JFactory::getDbo();
$query = $db->getQuery(true);
$query->select('parent_id');
$query->from('#__judownload_templates');
$query->where('id = ' . $templateId);
$db->setQuery($query);
$templateParentId = $db->loadResult();
$query = $db->getQuery(true);
$query->select('*');
$query->select('title AS text');
$query->select('id AS value');
$query->from('#__judownload_template_styles');
$query->where('template_id =' . $templateParentId);
$query->order('lft ASC');
$db->setQuery($query);
$styleObjectList = $db->loadObjectList();
$html = "";
$html .= "<option value=\"\">" . JText::_('COM_JUDOWNLOAD_SELECT_PARENT_TEMPLATE') . "</option>";
if (!empty($styleObjectList)) {
foreach ($styleObjectList as $styleObject) {
$html .= "<option value=\"" . $styleObject->value . "\">" . $styleObject->text . "</option>";
}
}
JUDownloadHelper::obCleanData();
echo $html;
exit;
}
示例9: approve
function approve($comment_ids)
{
if (!is_array($comment_ids) || empty($comment_ids)) {
$this->setError('COM_JUDOWNLOAD_NO_ITEM_SELECTED');
return false;
}
JTable::addIncludePath(JPATH_ADMINISTRATOR . '/components/com_judownload/tables');
$comment_table = JTable::getInstance("Comment", "JUDownloadTable");
$count = 0;
$comment_ids = (array) $comment_ids;
$rootComment = JUDownloadFrontHelperComment::getRootComment();
$docIds = array();
foreach ($comment_ids as $comment_id) {
$comment_table->reset();
if ($comment_table->load($comment_id) && $comment_table->parent_id == $rootComment->id && $comment_table->approved == 0) {
$docIds[$comment_table->doc_id] = $comment_table->doc_id;
}
$user = JFactory::getUser();
$date = JFactory::getDate();
$comment_table->approved = 1;
$comment_table->published = 1;
$comment_table->approved_by = $user->id;
$comment_table->approved_time = $date->toSql();
$comment_table->store();
$count++;
JUDownloadFrontHelperMail::sendEmailByEvent('comment.approve', $comment_id);
$logData = array('user_id' => $comment_table->user_id, 'event' => 'comment.approve', 'item_id' => $comment_id, 'doc_id' => $comment_table->doc_id, 'value' => 0, 'reference' => '');
JUDownloadFrontHelperLog::addLog($logData);
}
foreach ($docIds as $docId) {
JUDownloadHelper::rebuildRating($docId);
}
return $count;
}
示例10: loadLanguageForTopLevelCat
public static function loadLanguageForTopLevelCat()
{
$app = JFactory::getApplication();
$view = $app->input->getString('view', '');
$id = $app->input->getInt('id', 0);
if (isset($view))
{
switch ($view)
{
case 'category':
$topLevelCats = JUDownloadHelper::getCatsByLevel(1, $id);
break;
case 'document':
$catId = JUDownloadFrontHelperCategory::getMainCategoryId($id);
$topLevelCats = JUDownloadHelper::getCatsByLevel(1, $catId);
break;
}
if (!empty($topLevelCats))
{
$topLevelCat = $topLevelCats[0];
if ($view == 'category' || $view == 'document')
{
JUDownloadFrontHelperLanguage::loadLanguageFile('com_judownload_' . $topLevelCat->id, JPATH_SITE);
}
}
}
return;
}
示例11: getOptions
protected function getOptions()
{
$document = JFactory::getDocument();
if (JUDownloadHelper::isJoomla3x()) {
$triggerJqueryChosen = '$("#jform_parent_id").trigger("liszt:updated");';
} else {
$triggerJqueryChosen = '';
}
$script = '
jQuery(document).ready(function($){
$("#jform_template_id").change(function(){
var objData = {};
objData.value = $(this).val();
$.ajax({
type: "POST",
url : "index.php?option=com_judownload&task=style.changeTemplateId",
data: objData
}).done(function (data) {
$("option","#jform_parent_id").remove();
$("#jform_parent_id").append(data);
' . $triggerJqueryChosen . '
});
});
});
';
$document->addScriptDeclaration($script);
$db = JFactory::getDbo();
$options = array();
$styleId = $this->form->getValue('id');
if ($styleId) {
$templateId = $this->form->getValue('template_id');
$query = $db->getQuery(true);
$query->select('parent_id');
$query->from('#__judownload_templates');
$query->where('id = ' . (int) $templateId);
$db->setQuery($query);
$templateParentId = $db->loadResult();
} else {
$templateParentId = 0;
}
$query = $db->getQuery(true);
$query->select('*');
$query->select('title AS text');
$query->select('id AS value');
$query->from('#__judownload_template_styles');
$query->where('template_id = ' . (int) $templateParentId);
$query->order('lft ASC');
$db->setQuery($query);
try {
$options = $db->loadObjectList();
} catch (RuntimeException $e) {
JError::raiseWarning(500, $e->getMessage());
}
for ($i = 0, $n = count($options); $i < $n; $i++) {
$options[$i]->text = str_repeat('- ', $options[$i]->level) . $options[$i]->text;
}
$options = array_merge(parent::getOptions(), $options);
return $options;
}
示例12: docChangeCategory
public function docChangeCategory()
{
$model = $this->getModel();
$data = $model->docChangeCategory();
JUDownloadHelper::obCleanData();
echo $data;
exit;
}
示例13: populateState
protected function populateState($ordering = null, $direction = null)
{
$app = JFactory::getApplication();
$catId = $app->input->getInt('id', 1);
$params = JUDownloadHelper::getParams($catId);
$this->setState('params', $params);
}
示例14: getCriteriaGroupIdByCategoryId
public static function getCriteriaGroupIdByCategoryId($mainCatId)
{
$catObj = JUDownloadHelper::getCategoryById($mainCatId);
if ($catObj)
{
return $catObj->criteriagroup_id;
}
return null;
}
示例15: docChangeCategory
public function docChangeCategory()
{
require_once JPATH_ADMINISTRATOR . '/components/com_judownload/models/category.php';
JModelLegacy::addIncludePath(JPATH_ADMINISTRATOR . '/components/com_judownload/models');
$backendCategoryModel = JModelLegacy::getInstance('Category', 'JUDownloadModel');
$data = $backendCategoryModel->docChangeCategory();
JUDownloadHelper::obCleanData();
echo $data;
exit();
}