• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP SibdietHelper类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: addToolbar

 /**
  * Add the page title and toolbar.
  */
 protected function addToolbar()
 {
     JFactory::getApplication()->input->set('hidemainmenu', true);
     $user = JFactory::getUser();
     $isNew = $this->item->id == 0;
     $checkedOut = !($this->item->checked_out == 0 || $this->item->checked_out == $user->get('id'));
     $canDo = SibdietHelper::getActions();
     JToolBarHelper::title(JText::_('COM_SIBDIET_MANAGER_ERRAND'), 'database errands');
     // If not checked out, can save the item.
     if (!$checkedOut && ($canDo->get('core.edit') || $canDo->get('core.create'))) {
         JToolBarHelper::apply('errand.apply');
         JToolBarHelper::save('errand.save');
     }
     if (!$checkedOut && $canDo->get('core.create')) {
         JToolbarHelper::save2new('errand.save2new');
     }
     // If an existing item, can save to a copy.
     if (!$isNew && $canDo->get('core.create')) {
         JToolbarHelper::save2copy('errand.save2copy');
     }
     if (empty($this->item->id)) {
         JToolBarHelper::cancel('errand.cancel');
     } else {
         JToolBarHelper::cancel('errand.cancel', 'JTOOLBAR_CLOSE');
     }
 }
开发者ID:smhnaji,项目名称:sdnet,代码行数:29,代码来源:view.html.php


示例2: getInput

 /**
  * Method to get the field input markup for check boxes.
  *
  * @return  string  The field input markup.
  *
  * @since   11.1
  */
 protected function getInput()
 {
     $html = array();
     // Get default id
     $this->defaults_id = $this->form->getValue('defaults_id') ? $this->form->getValue('defaults_id') : 0;
     // Set days
     $days = $this->element['days'] ? $this->element['days'] : '1-2-3-4-5-6-7';
     $days = $this->form->getValue('days') ? $this->form->getValue('days') : $days;
     $days = explode('-', $days);
     // Set meals
     $meals = $this->element['meals'] ? $this->element['meals'] : '1,2,3';
     $meals = $this->form->getValue('meal') ? $this->form->getValue('meal') : $meals;
     $meals = explode(',', $meals);
     // Temp value
     $value_array = $this->value;
     foreach ($meals as $meal) {
         $this->meal = $meal;
         $options = (array) $this->getOptions();
         $html[] = '<div class="span4">';
         $html[] = '<div class="control-group center">' . SibdietHelper::convertMeals($meal) . '</div>';
         foreach ($days as $day) {
             $this->value = isset($value_array[$meal][$day]) ? $value_array[$meal][$day] : '';
             $this->name = 'jform[' . $this->fieldname . '][' . $meal . '][' . $day . ']';
             $this->id = $this->id . 'meal' . $meal . 'day' . $day;
             $this->hint = SibdietHelper::dayToString($day);
             $html[] = '<div class="control-group center">';
             $html[] = parent::getInput();
             $html[] = '</div>';
         }
         $html[] = '</div>';
     }
     return implode($html);
 }
开发者ID:smhnaji,项目名称:sdnet,代码行数:40,代码来源:defaultsfoods.php


示例3: display

 /**
  * Display the view
  *
  * @param   string  $tpl  The name of the template file to parse; automatically searches through the template paths.
  *
  * @return  void
  */
 public function display($tpl = null)
 {
     if ($this->getLayout() !== 'modal') {
         SibdietHelper::addSubmenu('profiles');
     }
     $this->items = $this->get('Items');
     $this->pagination = $this->get('Pagination');
     $this->state = $this->get('State');
     $this->filterForm = $this->get('FilterForm');
     $this->activeFilters = $this->get('ActiveFilters');
     // Check for errors.
     if (count($errors = $this->get('Errors'))) {
         JError::raiseError(500, implode("\n", $errors));
         return false;
     }
     $this->permissions = SibdietHelper::getUserPermissions();
     if ($this->getLayout() !== 'modal') {
         // Calculate profile refer No.
         foreach ($this->items as $item) {
             $item->referNo = SibdietHelper::getReferNo($item->id);
         }
         $this->addToolbar();
         $this->sidebar = JHtmlSidebar::render();
     }
     if (in_array('profiles', $this->permissions) || $this->getLayout() == 'modal') {
         parent::display($tpl);
     }
 }
开发者ID:smhnaji,项目名称:sdnet,代码行数:35,代码来源:view.html.php


示例4: allowEdit

 /**
  * Method override to check if you can edit an existing record.
  *
  * @param   array   $data  An array of input data.
  * @param   string  $key   The name of the key for the primary key.
  *
  * @return  boolean
  *
  * @since   1.6
  */
 protected function allowEdit($data = array(), $key = 'id')
 {
     $permissions = SibdietHelper::getUserPermissions();
     $recordId = (int) isset($data[$key]) ? $data[$key] : 0;
     $user = JFactory::getUser();
     $userId = $user->get('id');
     // Check requests manage permission first.
     if ($this->input->get('return') == 'requestschecks') {
         if (in_array('requestschecks', $permissions)) {
             return parent::allowEdit($data, $key);
         }
     } elseif (in_array('requests', $permissions)) {
         // Check that diet not started
         if ($recordId) {
             // Need to do a lookup from the model.
             $record = $this->getModel()->getItem($recordId);
             if ($record->room1 || $record->room2 || $record->room3 || $record->room4 || $record->room5 || $record->room6) {
                 return false;
             }
             // Now test the owner is the user.
             $ownerId = (int) isset($data['created_by']) ? $data['created_by'] : 0;
             if (empty($ownerId)) {
                 if (empty($record)) {
                     return false;
                 }
                 $ownerId = $record->created_by;
             }
             // If the owner matches 'me' then do the test.
             if ($ownerId == $userId) {
                 return true;
             }
         }
     }
     return false;
 }
开发者ID:smhnaji,项目名称:sdnet,代码行数:45,代码来源:request.php


示例5: display

 /**
  * Execute and display a template script.
  *
  * @param   string  $tpl  The name of the template file to parse; automatically searches through the template paths.
  *
  * @return  mixed  A string if successful, otherwise a Error object.
  */
 public function display($tpl = null)
 {
     $app = JFactory::getApplication();
     $user = JFactory::getUser();
     $this->item = $this->get('Item');
     $this->print = $app->input->getBool('print');
     $this->secretkey = $app->input->getString('secretkey');
     $this->state = $this->get('State');
     $this->user = $user;
     $this->params = $this->state->get('params');
     // Check for errors.
     if (count($errors = $this->get('Errors'))) {
         JError::raiseWarning(500, implode("\n", $errors));
         return false;
     }
     // Check the view access to the request print.
     if ($user->get('guest')) {
         if (!empty($this->secretkey) && $this->secretkey == $this->item->secretkey) {
             // User requested diet print by secret key
         } else {
             JError::raiseWarning(403, JText::_('JERROR_ALERTNOAUTHOR'));
             return;
         }
     }
     // Convert body field to array.
     $registry = new JRegistry();
     $registry->loadString($this->item->body);
     $this->item->body = $registry->toArray();
     $this->item = (object) array_merge((array) $this->item, $this->item->body);
     $this->item = SibdietHelper::calculate($this->item);
     //Escape strings for HTML output
     $this->pageclass_sfx = htmlspecialchars($this->params->get('pageclass_sfx'));
     $this->_prepareDocument();
     parent::display($tpl);
 }
开发者ID:smhnaji,项目名称:sdnet,代码行数:42,代码来源:view.html.php


示例6: featured

 /**
  * Method to toggle the featured setting of a list of articles.
  *
  * @return  void
  *
  * @since   1.6
  */
 public function featured()
 {
     // Check for request forgeries
     JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN'));
     $user = JFactory::getUser();
     $ids = $this->input->get('cid', array(), 'array');
     $values = array('featured' => 1, 'unfeatured' => 0);
     $task = $this->getTask();
     $value = JArrayHelper::getValue($values, $task, 0, 'int');
     // Access checks.
     foreach ($ids as $i => $id) {
         $permissions = SibdietHelper::getUserPermissions();
         if (!in_array('nutrients', $permissions) || !$user->authorise('core.edit.state', 'com_sibdiet.nutrient.' . (int) $id)) {
             // Prune items that you can't change.
             unset($ids[$i]);
             JError::raiseNotice(403, JText::_('JLIB_APPLICATION_ERROR_EDITSTATE_NOT_PERMITTED'));
         }
     }
     if (empty($ids)) {
         JError::raiseWarning(500, JText::_('JERROR_NO_ITEMS_SELECTED'));
     } else {
         // Get the model.
         $model = $this->getModel();
         // Publish the items.
         if (!$model->featured($ids, $value)) {
             JError::raiseWarning(500, $model->getError());
         }
         if ($value == 1) {
             $message = JText::plural('COM_SIBDIET_N_ITEMS_FEATURED', count($ids));
         } else {
             $message = JText::plural('COM_SIBDIET_N_ITEMS_UNFEATURED', count($ids));
         }
     }
     $this->setRedirect('index.php?option=com_sibdiet&view=nutrients', false, $message);
 }
开发者ID:smhnaji,项目名称:sdnet,代码行数:42,代码来源:nutrients.php


示例7: getInput

 /**
  * Method to get the field input markup.
  *
  * @return  string  The field input markup.
  *
  * @since   11.1
  */
 protected function getInput()
 {
     $html = parent::getInput();
     $default = SibdietHelper::getDefault((int) $this->value);
     $class = $this->element['class'] ? ' class="control-label ' . (string) $this->element['class'] . '"' : 'control-label';
     $html .= '<div' . $class . '>' . $default . '</div>';
     return $html;
 }
开发者ID:smhnaji,项目名称:sdnet,代码行数:15,代码来源:default.php


示例8: allowEdit

 /**
  * Method override to check if you can edit an existing record.
  *
  * @param   array   $data  An array of input data.
  * @param   string  $key   The name of the key for the primary key.
  *
  * @return  boolean
  *
  * @since   1.6
  */
 protected function allowEdit($data = array(), $key = 'id')
 {
     $permissions = SibdietHelper::getUserPermissions();
     if (in_array('sweeteners', $permissions)) {
         return parent::allowEdit($data, $key);
     } else {
         return false;
     }
 }
开发者ID:smhnaji,项目名称:sdnet,代码行数:19,代码来源:sweetener.php


示例9: getOptions

 /**
  * Method to get the field options.
  *
  * @return  array  The field option objects.
  *
  * @since   11.1
  */
 public function getOptions()
 {
     $type = NULL;
     $jinput = JFactory::getApplication()->input;
     if ($jinput->get('view') == 'request') {
         if ($jinput->get('return')) {
             $type = 'con';
         } else {
             $type = 'opt';
         }
     }
     $options = SibdietHelper::getConTagsOptions($type);
     return array_merge(parent::getOptions(), $options);
 }
开发者ID:smhnaji,项目名称:sdnet,代码行数:21,代码来源:contags.php


示例10: printCompositions

 /**
  * Get compositions & print
  */
 public function printCompositions($compositions)
 {
     echo '<ul>';
     $db = JFactory::getDbo();
     $compositions = json_decode($compositions, true);
     foreach ($compositions as $key => $comp) {
         $query = "\n\t\t\t\tSELECT\n\t\t\t\t  c.title,\n\t\t\t\t  c.compositions,\n\t\t\t\t  c.print_title\n\t\t\t\tFROM\n\t\t\t\t  #__sibdiet_compositions c\n\t\t\t\tWHERE\n\t\t\t\t  c.id = " . $key;
         $db->setQuery($query);
         $composition = $db->loadObject();
         if ($composition) {
             $print_title = SibdietHelper::getLanguagePrint($composition->print_title);
             $title = $print_title ? $print_title : $composition->title;
             echo '<li>' . $title . ' (' . $comp . ')';
             if ($composition->compositions) {
                 $this->printCompositions($composition->compositions);
             }
             echo '</li>';
         }
     }
     echo '</ul>';
 }
开发者ID:smhnaji,项目名称:sdnet,代码行数:24,代码来源:view.html.php


示例11: getInput

 /**
  * Method to get the field options.
  *
  * @return  array  The field option objects.
  *
  * @since   11.1
  */
 protected function getInput()
 {
     $html = array();
     $document = JFactory::getDocument();
     // Get the Units field options.
     $unitsoptions = SibdietHelper::getUnitsOptions();
     $unitsfield = JHtml::_('select.genericlist', $unitsoptions, 'jform[' . $this->fieldname . '][#index#][unit]', 'class="input-medium input-unit required"', 'value', 'text', '', $this->id . 'unit#index#');
     $unitsfield = preg_replace("/\\s+/", " ", $unitsfield);
     $inputhtml = '<div id="' . $this->id . 'div#index#" class="input-prepend input-append row-fluid"><span class="add-on"><label for="' . $this->id . '#index#" title="#name#">#name#</label></span><input type="text" class="validate-numeric input-mini required" value="" required="required" name="jform[' . $this->fieldname . '][#index#][amount]" id="' . $this->id . '#index#">' . $unitsfield . '<input type="text" class="input-mini required" required="required" value="" name="jform[' . $this->fieldname . '][#index#][uamount]" id="' . $this->id . 'uamount#index#"><span class="btn add-on"><i class="icon-delete" onclick="removeComposition(#index#)"></i></span></div>';
     $script = "\nfunction removeComposition(cid)\n{\n\tvar compo = '#{$this->id}'+'div'+cid;\n\tjQuery(compo).remove();\n\n\tvar compoopt = '#{$this->id} option[value=\"'+cid+'\"]';\n\tjQuery(compoopt).removeAttr('disabled');\n\tjQuery('#{$this->id}').trigger('liszt:updated');\n}\n\nfunction newComposition()\n{\n\tvar seletedoption = jQuery('#{$this->id}').find(\":selected\");\n\tvar selectedvalue = jQuery(seletedoption).val();\n\tif(selectedvalue){\n\t\tvar selectedtext = jQuery(seletedoption).text();\n\t\tvar inputtext = '{$inputhtml}';\n\t\tinputtext = inputtext.replace(/#index#/g, selectedvalue);\n\t\tinputtext = inputtext.replace(/#name#/g, selectedtext);\n\t\tjQuery('#subcompositions').append(inputtext);\n\t\tjQuery(seletedoption).attr('disabled','disabled');\n\t\tjQuery('#{$this->id} option:first').attr('selected','selected');\n\t\tvar unitsinputid = '#jform_compositionsunit' + selectedvalue;\n\t}\n\tjQuery('#{$this->id}').trigger('liszt:updated');\n}";
     $document->addScriptDeclaration($script);
     $this->onchange = 'newComposition()';
     $html[] = parent::getInput();
     $html[] = '<br /><br /><div id="subcompositions"><span></span>';
     $db = JFactory::getDbo();
     foreach ($this->value as $key => $value) {
         $query = $db->getQuery(true)->select("title, print_title")->from('#__sibdiet_compositions AS a')->where("a.id = " . $key);
         $db->setQuery($query);
         $result = $db->loadObject();
         if ($result) {
             $lang_tag = JFactory::getLanguage()->get('tag');
             // Convert the print_title field to an array.
             $registry = new JRegistry();
             $registry->loadString($result->print_title);
             $print_title = $registry->toArray();
             $name = array_key_exists($lang_tag, $print_title) ? $result->title . ' { ' . $print_title[$lang_tag] . ' }' : $result->title;
             $opthtml = str_replace('#index#', $key, $inputhtml);
             $count = 1;
             $opthtml = preg_replace('/value=""/', 'value="' . $value['amount'] . '"', $opthtml, 1);
             $opthtml = str_replace('value=""', 'value="' . $value['uamount'] . '"', $opthtml);
             $opthtml = str_replace('#name#', $name, $opthtml);
             $opthtml = str_replace('value="' . $value['unit'] . '"', 'value="' . $value['unit'] . '" selected="selected"', $opthtml);
             $html[] = $opthtml;
         }
     }
     $html[] = '</div>';
     return implode($html);
 }
开发者ID:smhnaji,项目名称:sdnet,代码行数:45,代码来源:subcompositions.php


示例12: prepareTable

 /**
  * Prepare and sanitise the table prior to saving.
  */
 protected function prepareTable($table)
 {
     $table->title = SibdietHelper::correctPersianAlphabet(htmlspecialchars_decode($table->title, ENT_QUOTES));
 }
开发者ID:smhnaji,项目名称:sdnet,代码行数:7,代码来源:contag.php


示例13: prepareTable

 /**
  * Prepare and sanitise the table prior to saving.
  */
 protected function prepareTable($table)
 {
     require_once JPATH_COMPONENT . '/helpers/sibdiet.php';
     $table->title = SibdietHelper::correctPersianAlphabet(htmlspecialchars_decode($table->title, ENT_QUOTES));
 }
开发者ID:smhnaji,项目名称:sdnet,代码行数:8,代码来源:goal.php


示例14: defined

<?php

/**
 * @package     Sibdiet.Administrator
 * @subpackage  com_sibdiet
 *
 * @copyright   Copyright (C) Open Source Matters, Inc. All rights reserved.
 * @license     GNU General Public License version 2 or later; see LICENSE.txt
 */
defined('_JEXEC') or die;
JHtml::addIncludePath(JPATH_COMPONENT . '/helpers/html');
JHtml::_('behavior.formvalidation');
SibdietHelper::chosen('select');
// Import CSS
$document = JFactory::getDocument();
$document->addStyleSheet('components/com_sibdiet/assets/css/sibdiet.css');
?>
<script type="text/javascript">
	Joomla.submitbutton = function(task)
	{
		if (task == 'nutrient.cancel' || document.formvalidator.isValid(document.id('nutrient-form')))
		{
			Joomla.submitform(task, document.getElementById('nutrient-form'));
		}
	}
</script>

<form action="<?php 
echo JRoute::_('index.php?option=com_sibdiet&layout=edit&id=' . (int) $this->item->id);
?>
" method="post" name="adminForm" id="nutrient-form" class="form-validate">
开发者ID:smhnaji,项目名称:sdnet,代码行数:31,代码来源:edit.php


示例15: defined

<?php

/**
 * @package     Sibdiet.Administrator
 * @subpackage  com_sibdiet
 *
 * @copyright   Copyright (C) Open Source Matters, Inc. All rights reserved.
 * @license     GNU General Public License version 2 or later; see LICENSE.txt
 */
defined('_JEXEC') or die;
JHtml::addIncludePath(JPATH_COMPONENT . '/helpers/html');
JHtml::_('behavior.formvalidation');
SibdietHelper::chosen();
// Import CSS
$document = JFactory::getDocument();
$document->addStyleSheet('components/com_sibdiet/assets/css/sibdiet.css');
?>
<script type="text/javascript">
	Joomla.submitbutton = function(task)
	{
		if (task == 'audio.cancel' || document.formvalidator.isValid(document.id('audio-form'))) {
			Joomla.submitform(task, document.getElementById('audio-form'));
		}
	}
</script>

<form action="<?php 
echo JRoute::_('index.php?option=com_sibdiet&layout=edit&id=' . (int) $this->item->id);
?>
" method="post" name="adminForm" id="audio-form" class="form-validate">
	<div class="form-horizontal">
开发者ID:smhnaji,项目名称:sdnet,代码行数:31,代码来源:edit.php


示例16: defined

 * @subpackage  com_sibdiet
 *
 * @copyright   Copyright (C) Open Source Matters, Inc. All rights reserved.
 * @license     GNU General Public License version 2 or later; see LICENSE.txt
 * @author      Mohammad Hasani Eghtedar <[email protected]>
 */
// no direct access
defined('_JEXEC') or die;
if ($this->item->sweeteners_id) {
    $allFoods++;
}
// Get Compositions
$query = $db->getQuery(true);
$query->select('s.compositions');
$query->from('#__sibdiet_sweeteners s');
$query->where('s.id = ' . (int) $this->item->sweeteners_id);
$db->setQuery($query);
$sweetenerCompositions = $db->loadObject();
$sweetenerNutrients = array();
if ($sweetenerCompositions) {
    // convert Composition json to array
    $registry = new JRegistry();
    $registry->loadString($sweetenerCompositions->compositions);
    $sweetenerCompositions = $registry->toArray();
    // Count compositions that have ph or gi
    $phCount = $giCount = 0;
    // Calculate nutrients
    $sweetenerNutrients = $sweetenerCompositions ? SibdietHelper::nutrientsCalc($sweetenerCompositions, $phCount, $giCount) : array();
    $tempNutrients = $sweetenerNutrients;
    require 'calculation_html.php';
}
开发者ID:smhnaji,项目名称:sdnet,代码行数:31,代码来源:calculation_sweetener.php


示例17: getOptions

 /**
  * Method to get the field options.
  *
  * @return  array  The field option objects.
  *
  * @since   11.1
  */
 public function getOptions()
 {
     $options = SibdietHelper::getDietsOptions();
     return array_merge(parent::getOptions(), $options);
 }
开发者ID:smhnaji,项目名称:sdnet,代码行数:12,代码来源:diets.php


示例18:

        }
        ?>
							<div class="small">
								<?php 
        echo JText::_('COM_SIBDIET_DIET') . ': ' . $this->escape($item->diets_title);
        ?>
							</div>
						</td>
						<td class="hidden-phone">
							<?php 
        echo SibdietHelper::convertMeals($item->meal);
        ?>
						</td>
						<td class="hidden-phone">
							<?php 
        echo SibdietHelper::convertSeasons($item->season);
        ?>
						</td>
						<td class="small nowrap hidden-phone">
							<?php 
        if ($item->language == '*') {
            ?>
								<?php 
            echo JText::alt('JALL', 'language');
            ?>
							<?php 
        } else {
            ?>
								<?php 
            echo $item->language_title ? $this->escape($item->language_title) : JText::_('JUNDEFINED');
            ?>
开发者ID:smhnaji,项目名称:sdnet,代码行数:31,代码来源:default.php


示例19:

          <span class="age hasTooltip" title="<?php 
echo JText::_('COM_SIBDIET_AGE');
?>
">
          <?php 
if (!empty($this->item->profile->birthday)) {
    $age = SibdietHelper::age($this->item->profile->birthday, $this->item->created);
    echo $age->y . '.' . $age->m;
}
?>
          </span>
          <?php 
echo $this->form->getInput('email', 'profile');
?>
          <?php 
$canDo = SibdietHelper::getActions();
?>
          <?php 
if ($canDo->get('room.1')) {
    echo $this->form->getInput('room1');
}
?>
          <?php 
if ($canDo->get('room.2')) {
    echo $this->form->getInput('room2');
}
?>
          <?php 
if ($canDo->get('room.3')) {
    echo $this->form->getInput('room3');
}
开发者ID:smhnaji,项目名称:sdnet,代码行数:31,代码来源:edit.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP Sidebar类代码示例发布时间:2022-05-23
下一篇:
PHP ShortcodeParser类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap