本文整理汇总了PHP中PFApplicationHelper::getProjectParams方法的典型用法代码示例。如果您正苦于以下问题:PHP PFApplicationHelper::getProjectParams方法的具体用法?PHP PFApplicationHelper::getProjectParams怎么用?PHP PFApplicationHelper::getProjectParams使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PFApplicationHelper
的用法示例。
在下文中一共展示了PFApplicationHelper::getProjectParams方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getInput
/**
* Method to get the user field input markup.
*
* @return string The field input markup.
*/
protected function getInput()
{
static $js_loaded = false;
if ($js_loaded === false) {
// Make sure the JS is loaded only once
$js_loaded = true;
$script = $this->getJavascript();
JFactory::getDocument()->addScriptDeclaration(implode("\n", $script));
}
$task_id = (int) $this->form->getValue('task_id');
$id = (int) $this->form->getValue('id');
if ($task_id && (!$this->value || $this->value == '0.00')) {
$db = JFactory::getDbo();
$query = $db->getQuery(true);
$query->select('rate')->from('#__pf_tasks')->where('id = ' . $task_id);
$db->setQuery($query);
$task_rate = $db->loadResult();
if ($task_rate) {
$this->value = $task_rate;
}
}
// Setup field values
if ($this->value) {
$v1 = substr($this->value, 0, -3);
$v2 = substr($this->value, -2);
} else {
$this->value = '0.00';
$v1 = '0';
$v2 = '00';
// Pre-fill from previously entered value
if (empty($id) || $id === '0') {
$cached = JFactory::getApplication()->getUserState('com_projectfork.' . $this->id);
if ($cached && $cached != '0.00') {
$this->value = $cached;
$v1 = substr($this->value, 0, -3);
$v2 = substr($this->value, -2);
}
}
}
// Get params
$params = PFApplicationHelper::getProjectParams();
// Initialize some field attributes.
$attribs = array();
$attribs['readonly'] = (string) $this->element['readonly'] == 'true' ? ' readonly="readonly"' : '';
$attribs['disabled'] = (string) $this->element['disabled'] == 'true' ? ' disabled="disabled"' : '';
$attribs['maxlength'] = (int) $this->element['maxlength'] != '' ? $this->element['maxlength'] : 4;
$attribs['currency'] = $params->get('currency_sign');
$attribs['decimal'] = $params->get('decimal_delimiter');
$attribs['position'] = $params->get('currency_position');
if ($attribs['readonly'] == '' && $attribs['disabled'] == '') {
$attribs['onchange'] = ' onchange="setMoneyFieldValue(\'' . $this->id . '\');"';
} else {
$attribs['onchange'] = '';
}
// Get HTML
$html = $this->getHTML($v1, $v2, $attribs);
// Return HTML
return implode("\n", $html);
}
示例2: __construct
public function __construct()
{
$pcfg = PFApplicationHelper::getProjectParams();
$this->curr_code = $pcfg->get('currency_code');
$this->curr_sign = $pcfg->get('currency_sign');
$this->curr_pos = $pcfg->get('currency_position');
$cid = (int) JRequest::getVar('cid', null);
$this->pid = $cid;
}
示例3: format
/**
* Formats the logged time into hours and seconds
*
* @param integer $secs The seconds spent
* @param string $style (Optional) Format style
*
* @return string The formatted time string
*/
public static function format($secs = 0, $style = 'literal')
{
static $nf_dec = null;
static $nf_th = null;
if ($nf_dec == null) {
$params = PFApplicationHelper::getProjectParams(0);
$nf_dec = $params->get('decimal_delimiter', '.');
$nf_th = $params->get('thousands_delimiter', ',');
}
$secs = intval($secs);
$format = '';
if (!$secs) {
return $format;
}
$minutes = $secs / 60;
$hours = floor($minutes / 60);
// Literal style
switch (strtolower($style)) {
case 'decimal':
if ($minutes > 0) {
$format = number_format($minutes / 60, 1, $nf_dec, $nf_th);
} else {
$format = 0.0;
}
break;
case 'literal':
default:
if ($hours > 0) {
$minutes = $minutes - $hours * 60;
}
$minutes = floor($minutes);
if ($hours) {
$format .= $hours . ' ' . ($hours > 1 ? JText::_('COM_PROJECTFORK_TIME_HOURS') : JText::_('COM_PROJECTFORK_TIME_HOUR'));
}
if ($minutes) {
if ($hours) {
$format .= ' ';
}
$format .= $minutes . ' ' . ($minutes > 1 ? JText::_('COM_PROJECTFORK_TIME_MINUTES') : JText::_('COM_PROJECTFORK_TIME_MINUTE'));
}
if (!$minutes && !$hours) {
$format .= '0 ' . JText::_('COM_PROJECTFORK_TIME_MINUTES');
}
break;
}
return $format;
}
示例4: money
/**
* Method to format a floating point value according the configured monetary settings
*
* @param float $value The amount of money
* @param int $project Optional project id from which to use the settings
*
* @return array $options The object list
*/
public static function money($value = 0.0, $project = 0)
{
$value = (double) $value;
$params = PFApplicationHelper::getProjectParams((int) $project);
$nf_dec = $params->get('decimal_delimiter', '.');
$nf_th = $params->get('thousands_delimiter', ',');
$currency = $params->get('currency_sign', '$');
$html = array();
if ($params->get('currency_position') == '0') {
$html[] = $currency . ' ';
}
$html[] = number_format($value, 2, $nf_dec, $nf_th);
if ($params->get('currency_position') == '1') {
$html[] = ' ' . $currency;
}
return implode('', $html);
}
示例5: defined
* @package Projectfork
* @subpackage Timetracking
*
* @author Tobias Kuhn (eaxs)
* @copyright Copyright (C) 2006-2013 Tobias Kuhn. All rights reserved.
* @license http://www.gnu.org/licenses/gpl.html GNU/GPL, see LICENSE.txt
*/
defined('_JEXEC') or die;
JHtml::_('pfhtml.script.form');
JHtml::_('pfhtml.script.listform');
JHtml::_('pfhtml.script.timerec');
$last_time = time() - $this->time;
if ($last_time > 60) {
$last_time = 0;
}
$pcfg = PFApplicationHelper::getProjectParams();
$currency_sign = $pcfg->get('currency_sign');
$currency_del = $pcfg->get('decimal_delimiter');
$currency_pos = $pcfg->get('currency_position');
?>
<script type="text/javascript">
jQuery(document).ready(function() {
PFtimerec.setForm('adminForm');
PFtimerec.setTicker('ticker', 'ticker-progress');
setInterval(PFtimerec.tick, 1000);
PFform.radio2btngroup();
});
function setRateFieldValue(i)
示例6: getItemFromProjectPath
public function getItemFromProjectPath($project, $path)
{
$params = PFApplicationHelper::getProjectParams((int) $project);
$repo_dir = (int) $params->get('repo_dir');
$query = $this->_db->getQuery(true);
// Remove trailing slash
if (substr($path, -1) == '/') {
$path = substr($path, 0, -1);
}
// Can't get a path without project repo dir
if (!$repo_dir) {
return false;
}
$query->select('alias')->from('#__pf_repo_dirs')->where('id = ' . (int) $repo_dir);
$this->_db->setQuery($query);
$alias = $this->_db->loadResult();
$query->clear();
$query->select('id')->from('#__pf_repo_dirs')->where('project_id = ' . (int) $project)->where('path = ' . $this->_db->quote($alias . '/' . $path));
$this->_db->setQuery($query);
$id = (int) $this->_db->loadResult();
if ($id) {
return $this->getItem($id);
}
return false;
}
示例7: populateState
/**
* Method to auto-populate the model state.
* Note: Calling getState in this method will result in recursion.
*
* @return void
*/
protected function populateState($ordering = 'a.title', $direction = 'asc')
{
// Initialise variables.
$app = JFactory::getApplication();
$params = $app->getParams();
// Adjust the context to support modal layouts.
if ($layout = JRequest::getVar('layout')) {
$this->context .= '.' . $layout;
}
// Set Params
$this->setState('params', $params);
// Config - Count elements
$this->setState('list.count_elements', (int) $params->get('show_element_count'));
// Filter - Search
$search = $this->getUserStateFromRequest($this->context . '.filter.search', 'filter_search');
$this->setState('filter.search', $search);
// Filter - Access
$access = $this->getUserStateFromRequest($this->context . '.filter.access', 'filter_access', '');
$this->setState('filter.access', $access);
// Filter - Project
$project = PFApplicationHelper::getActiveProjectId('filter_project');
// Filter - Author
$author_id = $app->getUserStateFromRequest($this->context . '.filter.author_id', 'filter_author_id');
$this->setState('filter.author_id', $author_id);
// Filter - Labels
$labels = (array) JRequest::getVar('filter_label', array(), 'post', 'array');
$this->setState('filter.labels', $labels);
// Filter - Directory
$parent_id = JRequest::getVar('filter_parent_id');
// Get the path
$path = str_replace(':', '-', JRequest::getVar('path'));
if (!$parent_id && !empty($path) && $project > 0) {
// No parent folder given. Try to find it from the path
$dir = $this->getInstance('DirectoryForm', 'PFrepoModel', $config = array('ignore_request' => true));
$item = $dir->getItemFromProjectPath($project, $path);
if ($item) {
$parent_id = $item->id;
JRequest::setVar('filter_parent_id', $parent_id);
}
}
// If no parent folder is given, find the repo dir of the project
if (empty($parent_id) && $project > 0) {
$params = PFApplicationHelper::getProjectParams();
$repo = (int) $params->get('repo_dir');
if ($repo) {
$parent_id = (int) $repo;
}
} elseif (is_numeric($parent_id) && $project <= 0) {
// If a folder is selected, but no project, find the project id of the folder
if ($project === "") {
$parent_id = 1;
$project = 0;
} else {
$dir = $this->getInstance('DirectoryForm', 'PFrepoModel', $config = array('ignore_request' => true));
$item = $dir->getItem((int) $parent_id);
if ($item->id > 0) {
if ($item->parent_id == '1') {
$project = $item->project_id;
} else {
$parent_id = 1;
$project = 0;
}
} else {
$parent_id = 1;
$project = 0;
}
}
} elseif ($project <= 0 && empty($parent_id)) {
$parent_id = 1;
$project = 0;
}
if (JRequest::getVar('filter_project', null, 'post') === '0') {
$parent_id = 1;
$project = 0;
}
PFApplicationHelper::setActiveProject($project);
$this->setState('filter.project', $project);
$this->setState('filter.parent_id', $parent_id);
// Override the user input to control the other models
JRequest::setVar('filter_parent_id', $parent_id);
JRequest::setVar('filter_project', $project);
// Handle list limit
JRequest::setVar('limit', $app->getCfg('list_limit'));
// Do not allow to filter by author if no project is selected
if ($project <= 0) {
$this->setState('filter.labels', array());
$this->setState('filter.author_id', '');
$labels = array();
$author_id = '';
}
// Filter - Is set
$this->setState('filter.isset', !empty($search) || count($labels) || is_numeric($author_id));
// List state information.
parent::populateState($ordering, $direction);
//.........这里部分代码省略.........
示例8: onAfterRender
public function onAfterRender()
{
$option = JRequest::getVar('option');
$view = JRequest::getVar('view');
$action = JRequest::getVar('action', null);
$cid = (int) JRequest::getVar('cid', null);
$results = null;
$cids = array();
if ($option == 'com_pfprojects') {
if ($view == 'projects') {
$html = JResponse::getBody();
$cids = $this->_getProjectIds($html);
$replaced = $this->_getTagText($html);
$results = $this->_addProjectIds($replaced, $cids);
if ($action && $action == 'export') {
/* TODO: add to helper class: start: */
if ($cid) {
$pcfg = PFApplicationHelper::getProjectParams();
//$curr_code = $pcfg->get('currency_code');
//$curr_sign = $pcfg->get('currency_sign');
//$curr_del = $pcfg->get('decimal_delimiter');
//$curr_pos = $pcfg->get('currency_position');
/* TODO: add to helper class: end: */
$helper = new PFtomsprojectHelper($cid);
$helper->getProjectInfo();
$helper->exportXML($this->duration_format);
}
}
}
}
if ($results) {
JResponse::setBody($results);
}
}
示例9: populateState
/**
* Method to auto-populate the model state.
* Note: Calling getState in this method will result in recursion.
*
* @return void
*/
protected function populateState($ordering = 'a.title', $direction = 'asc')
{
// Initialise variables.
$params = JComponentHelper::getParams('com_pfrepo');
$app = JFactory::getApplication();
// Adjust the context to support modal layouts.
if ($layout = JRequest::getVar('layout')) {
$this->context .= '.' . $layout;
}
// Config - Count elements
$this->setState('list.count_elements', (int) $params->get('show_element_count'));
// Filter - Search
$search = $this->getUserStateFromRequest($this->context . '.filter.search', 'filter_search');
$this->setState('filter.search', $search);
// Filter - Access
$access = $this->getUserStateFromRequest($this->context . '.filter.access', 'filter_access', '');
$this->setState('filter.access', $access);
// Filter - Project
$project = PFApplicationHelper::getActiveProjectId('filter_project');
// Filter - Author
$author_id = $app->getUserStateFromRequest($this->context . '.filter.author_id', 'filter_author_id');
$this->setState('filter.author_id', $author_id);
// Filter - Directory
$parent_id = JRequest::getVar('filter_parent_id');
// If no parent folder is given (or in root), find the repo dir of the project
if ($parent_id <= 1 && $project) {
$params = PFApplicationHelper::getProjectParams();
$repo = (int) $params->get('repo_dir');
if ($repo) {
$parent_id = (int) $repo;
}
} elseif ($parent_id > 1 && !$project) {
// If a folder is selected, but no project active, find the project id of the folder
$query = $this->_db->getQuery(true);
$query->select('project_id')->from('#__pf_repo_dirs')->where('id = ' . (int) $parent_id);
$this->_db->setQuery($query);
$project = (int) $this->_db->loadResult();
// If no project was found, return to the repo root
if (!$project) {
$parent_id = 1;
}
} elseif (empty($parent_id) && !$project) {
$parent_id = 1;
$project = 0;
}
if (JRequest::getVar('filter_project', null, 'post') === '0') {
$parent_id = 1;
$project = 0;
}
PFApplicationHelper::setActiveProject($project);
$this->setState('filter.project', $project);
$this->setState('filter.parent_id', $parent_id);
// Override the user input to control the other models
JRequest::setVar('filter_parent_id', $parent_id);
JRequest::setVar('filter_project', $project);
// Handle list limit
if ($project) {
JRequest::setVar('limit', 0);
} else {
if (JRequest::getVar('limit') === null) {
JRequest::setVar('limit', $app->getCfg('list_limit'));
}
}
// List state information.
parent::populateState($ordering, $direction);
}