本文整理汇总了PHP中JRequest::getint方法的典型用法代码示例。如果您正苦于以下问题:PHP JRequest::getint方法的具体用法?PHP JRequest::getint怎么用?PHP JRequest::getint使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类JRequest
的用法示例。
在下文中一共展示了JRequest::getint方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: display
function display($tpl = null)
{
// Get menu parameter
$itemid = JRequest::getint('Itemid');
$menu =& JSite::getMenu();
$item = $menu->getItem($itemid);
if ($item) {
$this->param_servertype = $item->params->get('servertype');
} else {
$this->param_servertype = "";
}
// Display the view
parent::display($tpl);
}
示例2: processPayment
/**
* Process payment
*
*/
function processPayment($row, $data)
{
$Itemid = JRequest::getint('Itemid');
$config = OSMembershipHelper::getConfig();
OSMembershipHelper::sendEmails($row, $config);
$db = JFactory::getDbo();
$sql = 'SELECT subscription_complete_url FROM #__osmembership_plans WHERE id=' . $row->plan_id;
$db->setQuery($sql);
$subscriptionCompleteURL = $db->loadResult();
if ($subscriptionCompleteURL) {
JFactory::getApplication()->redirect($subscriptionCompleteURL);
} else {
JFactory::getApplication()->redirect(JRoute::_('index.php?option=com_osmembership&view=complete&act=' . $row->act . '&subscription_code=' . $row->subscription_code . '&Itemid=' . $Itemid, false, false));
}
}
示例3: getItem
function getItem()
{
$model = $this->getModel('emails');
$id = JRequest::getint('id', 0);
$doc = $model->getItem($id);
$result = array();
if (empty($doc)) {
$result['total'] = 0;
$result['result'] = '';
} else {
$result['total'] = 1;
$result['result'] = $doc;
}
$result = oseJSON::encode($result);
oseExit($result);
}
示例4: save
function save()
{
$row =& JTable::getInstance('documents', 'Table');
$row->id = JRequest::getInt('id', 0);
$title = JRequest::getString('title', '');
$row->title = empty($title) ? '-- title missing --' : $title;
$description = JRequest::getVar('description', '', 'post', '', JREQUEST_ALLOWHTML);
$row->description = empty($description) ? '-- description missing --' : $description;
$row->date = JRequest::getString('date', '0000-00-00');
$row->type_id = JRequest::getInt('type', '');
$row->format_id = JRequest::getint('format', '');
$row->file_name = JRequest::getString('file_name', '');
$row->image_name = JRequest::getString('image_name', '');
$row->published = empty($title) || empty($description) ? 0 : JRequest::getInt('published', 0);
if (!$row->store()) {
JError::raiseError(500, $row->getError());
}
$option = JRequest::getVar('option', '');
if (JRequest::getVar('task', '') == 'apply') {
$this->setRedirect('index.php?option=' . $option . '&view=document&cid[]=' . $row->id, 'Document information saved.');
} else {
$this->setRedirect('index.php?option=' . $option . '&view=documents', 'Document information saved.');
}
}
示例5: __construct
function __construct()
{
parent::__construct();
$this->projectid = JRequest::getInt("p", 0);
$this->divisionid = JRequest::getint("division", 0);
}
示例6: _addLists
private function _addLists()
{
$app = JFactory::getApplication();
$option = $this->option;
$visibleLists = $this->params->get('lists', 'None');
if ($visibleLists == 'None') {
return;
}
$visibleListsArray = array();
$listsClass = acymailing_get('class.list');
$allLists = $listsClass->getLists('listid');
if (acymailing_level(1)) {
$allLists = $listsClass->onlyCurrentLanguage($allLists);
}
if (strpos($visibleLists, ',') or is_numeric($visibleLists)) {
$allvisiblelists = explode(',', $visibleLists);
foreach ($allLists as $oneList) {
if ($oneList->published and in_array($oneList->listid, $allvisiblelists)) {
$visibleListsArray[] = $oneList->listid;
}
}
} elseif (strtolower($visibleLists) == 'all') {
foreach ($allLists as $oneList) {
if ($oneList->published) {
$visibleListsArray[] = $oneList->listid;
}
}
}
if (empty($visibleListsArray)) {
return;
}
$checkedLists = $this->params->get('listschecked', 'All');
$userClass = acymailing_get('class.subscriber');
if ($app->isAdmin()) {
$jversion = preg_replace('#[^0-9\\.]#i', '', JVERSION);
if (version_compare($jversion, '1.6.0', '>=')) {
$currentUserId = JRequest::getint('id', 0);
} else {
$currentUserIdArray = JRequest::getVar('cid', array());
if (is_array($currentUserIdArray) && !empty($currentUserIdArray)) {
$currentUserId = array_shift($currentUserIdArray);
}
}
} else {
$loggedinUser = JFactory::getUser();
if (!empty($loggedinUser->id)) {
$currentUserId = $loggedinUser->id;
}
}
if (!empty($currentUserId)) {
$currentSubid = $userClass->subid($currentUserId);
if (!empty($currentSubid)) {
$currentSubscription = $userClass->getSubscriptionStatus($currentSubid, $visibleListsArray);
$checkedLists = '';
foreach ($currentSubscription as $listid => $oneSubsciption) {
if ($oneSubsciption->status == '1' || $oneSubsciption->status == '2') {
$checkedLists .= $listid . ',';
}
}
}
}
if (strtolower($checkedLists) == 'all') {
$checkedListsArray = $visibleListsArray;
} elseif (strpos($checkedLists, ',') or is_numeric($checkedLists)) {
$checkedListsArray = explode(',', $checkedLists);
} else {
$checkedListsArray = array();
}
$subText = $this->params->get('subscribetext');
if (empty($subText)) {
if (in_array($this->params->get('displaymode', 'dispall'), array('dispall', 'dropdown'))) {
$subText = JText::_('SUBSCRIPTION') . ':';
} else {
$subText = JText::_('YES_SUBSCRIBE_ME');
}
}
$body = JResponse::getBody();
$severalValueTest = false;
if ($this->params->get('fieldafter', 'password') == 'custom') {
$listAfter = explode(';', str_replace(array('\\[', '\\]'), array('[', ']'), $this->params->get('fieldaftercustom')));
$after = !empty($listAfter) ? $listAfter : $this->components[$option]['password'];
} elseif (!empty($this->components[$option][$this->params->get('fieldafter', 'password')])) {
$after = $this->components[$option][$this->params->get('fieldafter', 'password')];
} else {
$after = $this->params->get('fieldafter', 'password') == 'email' ? 'email' : 'password2';
}
if (is_array($after)) {
$severalValueTest = true;
$allAfters = $after;
$after = $after[0];
}
$listsDisplayed = '<input type="hidden" value="' . implode(',', $visibleListsArray) . '" name="acylistsdisplayed_' . $this->params->get('displaymode', 'dispall') . '" />';
$return = '';
if ($this->params->get('displaymode', 'dispall') == 'dispall') {
$return = '<table class="acy_lists" style="border:0px">';
foreach ($visibleListsArray as $oneList) {
$check = in_array($oneList, $checkedListsArray) ? 'checked="checked"' : '';
$return .= '<tr style="border:0px"><td style="border:0px"><input type="checkbox" id="acy_list_' . $oneList . '" class="acymailing_checkbox" name="acysub[]" ' . $check . ' value="' . $oneList . '"/></td><td style="border:0px;padding-left:10px;" nowrap="nowrap"><label for="acy_list_' . $oneList . '" class="acylabellist">';
$return .= $allLists[$oneList]->name;
$return .= '</label></td></tr>';
//.........这里部分代码省略.........
示例7: work_conveyer
function work_conveyer()
{
$energy_unit = 1;
$building_id = JRequest::getvar('building_id');
$line = JRequest::getvar('line');
$type = JRequest::getvar('type');
$quantity = JRequest::getint('quantity');
$energy_units = $energy_unit * $quantity;
$now = time();
$db = JFactory::getDBO();
$sql = "SELECT * FROM #__jigs_objects WHERE id = " . $type;
$db->setQuery($sql);
$product = $db->loadObject();
$user = JFactory::getUser();
$name = $product->name;
$description = $product->description;
$level = $product->level;
$man_time = $product->man_time;
$metal_1 = $product->metal_1;
$quantity_1 = $product->quantity_1;
$metal_2 = $product->metal_2;
$quantity_2 = $product->quantity_2;
$sql = "SELECT quantity FROM #__jigs_metals WHERE item_id = " . $metal_1 . " AND player_id = " . $user->id;
$resource = $db->setQuery($sql);
$player_qty_1 = $db->loadResult();
$sql = "SELECT quantity FROM #__jigs_metals WHERE item_id = " . $metal_2 . " AND player_id = " . $user->id;
$resource = $db->setQuery($sql);
$player_qty_2 = $db->loadResult();
$model = JModel::getInstance('jigs', 'BattleModel');
$energy_required = $quantity * 1;
if (!$model->use_battery($building_id, $energy_required)) {
return false;
}
if ($player_qty_1 >= $quantity_1 && $player_qty_2 >= $quantity_2) {
$player_qty_1 = $player_qty_1 - $quantity_1;
$player_qty_2 = $player_qty_2 - $quantity_2;
$finished = $now + $quantity * $man_time * 60;
$finished = $now + 1 * 1 * 60;
$sql = "INSERT INTO #__jigs_factories (building,line,type, quantity,timestamp,finished)\n VALUES ({$building_id}, {$line}, {$type}, {$quantity}, {$now}, {$finished} )\n ON DUPLICATE KEY UPDATE type = {$type} , quantity = {$quantity} , timestamp= {$now} ,finished = {$finished}";
$db->setQuery($sql);
if (!$db->query()) {
echo Json_encode($sql);
return false;
}
$sql = "UPDATE #__jigs_metals SET quantity = {$player_qty_1}\n WHERE item_id = " . $metal_1 . " AND player_id =" . $user->id;
$db->setQuery($sql);
if (!$db->query()) {
echo Json_encode($sql);
return false;
}
$sql = "UPDATE #__jigs_metals SET quantity = {$player_qty_2}\n WHERE item_id = " . $metal_2 . " AND player_id =" . $user->id;
$db->setQuery($sql);
if (!$db->query()) {
echo Json_encode($sql);
return false;
}
} else {
$message = "not enough metals";
echo Json_encode($message);
return false;
}
return true;
}
示例8: sortsplitimes
function sortsplitimes()
{
$model = $this->getModel();
$size = JRequest::getVar('newsplit') - 1;
//new entry record sequential number
$split = array();
/////////////////////LOAD FROM POST
for ($i = 0; $i <= $size; $i++) {
$teiler = explode(":", JRequest::getVar('ntime' . $i, 0));
$split[$i] = new stdClass();
$split[$i]->id = JRequest::getVar('split_id' . $i, 0);
$split[$i]->splittimesum = 3600 * $teiler[0] + 60 * $teiler[1] + $teiler[2];
$split[$i]->sport_id = JRequest::getint('sport' . $i);
$split[$i]->is_ref = JRequest::getint('is_ref' . $i);
$split[$i]->state = JRequest::getInt('pb' . $i);
}
for ($i = 0; $i < $size; $i++) {
for ($j = 0; $j < $size - 1 - $i; $j++) {
if ($split[$j + 1]->splittimesum < $split[$j]->splittimesum) {
$tmpsplittimesum = $split[$j]->splittimesum;
$tmpsport_id = $split[$j]->sport_id;
$tmpis_ref = $split[$j]->is_ref;
$tmpstate = $split[$j]->state;
$split[$j]->splittimesum = $split[$j + 1]->splittimesum;
$split[$j]->sport_id = $split[$j + 1]->sport_id;
$split[$j]->state = $split[$j + 1]->state;
$split[$j + 1]->splittimesum = $tmpsplittimesum;
$split[$j + 1]->sport_id = $tmpsport_id;
$split[$j + 1]->is_ref = $tmpis_ref;
$split[$j + 1]->state = $tmpstate;
}
}
}
$sumtime = 0;
//Calculate splittimes from splitsums and save
for ($i = 0; $i <= $size; $i++) {
$split[$i]->splittime = $split[$i]->splittimesum - $sumtime;
$sumtime = $split[$i]->splittimesum;
$model->modifySplittime($split[$i]);
}
return $split;
}
示例9: gantry_admin_getCurrentTemplateId
/**
* Get the template style id that is being worked with on the admin side
*
* @return bool|int
*/
function gantry_admin_getCurrentTemplateId()
{
$id = false;
$app =& JFactory::getApplication();
if ($app->isAdmin()) {
$session =& JFactory::getSession();
$session_registry =& $session->get('registry');
if (JRequest::getint('id', 0) > 0 && JRequest::getString('option') == 'com_gantry' && JRequest::getString('layout') == 'edit') {
$id = JRequest::getInt('id', 0);
} else {
if (JRequest::getString('option') == 'com_gantry' && JRequest::getString('task') == 'ajax') {
$name = JRequest::getString('template');
$id = gantry_getMasterTemplateStyleByName($name)->id;
} else {
if ($session_registry->exists('com_gantry.edit.template.id')) {
$session_ids = $session_registry->get('com_gantry.edit.template.id');
$id = (int) array_shift($session_ids);
}
}
}
}
return $id;
}
示例10:
<html>
<head>
<jdoc:include type="head" />
<?php
// Detecting Home
$site_app = JFactory::getApplication('Site');
$menu = $site_app->getMenu();
if ($menu->getActive() == $menu->getDefault()) {
$siteHome = 1;
} else {
$siteHome = 0;
}
// Add current user information
$user = JFactory::getUser();
// Grad the Itemid
$itemid = JRequest::getint('Itemid');
// Detecting Active Variables
$option = JRequest::getCmd('option', '');
$view = JRequest::getCmd('view', '');
$layout = JRequest::getCmd('layout', '');
$task = JRequest::getCmd('task', '');
$itemid = JRequest::getCmd('Itemid', '');
$sitename = $app->getCfg('sitename');
if ($task == "edit" || $layout == "form") {
$fullWidth = 1;
} else {
$fullWidth = 0;
}
// Added by jseliga
// Determine Name to Display
if ($this->params->get('nameDisplay') == "full") {
示例11: _addFields
private function _addFields()
{
if (!acymailing_level(3)) {
return;
}
$option = $this->option;
$app = JFactory::getApplication();
if ($app->isAdmin()) {
$area = 'joomlaprofile';
} elseif (!empty($this->components[$option]['edittasks']) && in_array($this->view, $this->components[$option]['edittasks'])) {
$area = 'frontjoomlaprofile';
} else {
$area = 'frontjoomlaregistration';
}
$fieldsClass = acymailing_get('class.fields');
$user = new stdClass();
$extraFields = $fieldsClass->getFields($area, $user);
$newOrdering = array();
foreach ($extraFields as $fieldnamekey => $oneField) {
if (in_array($oneField->namekey, array('name', 'email'))) {
continue;
}
$newOrdering[] = $fieldnamekey;
}
if (empty($newOrdering)) {
return;
}
$body = JResponse::getBody();
$severalValueTest = false;
if (!empty($this->components[$option][$this->params->get('customfieldsafter', 'email')])) {
$after = $this->components[$option][$this->params->get('customfieldsafter', 'email')];
} else {
if ($this->params->get('customfieldsafter', 'password') == 'custom') {
$after = $this->params->get('customfieldsaftercustom');
} else {
$after = $this->params->get('customfieldsafter', 'email') == 'email' ? 'email' : 'password2';
}
}
if (is_array($after)) {
$severalValueTest = true;
$allAfters = $after;
$after = $after[0];
}
$allFormats = array();
$allFormats['tr'] = array('tagfield' => 'tr', 'tagfieldname' => 'td', 'tagfieldvalue' => 'td');
$allFormats['li'] = array('tagfield' => 'li', 'tagfieldname' => '', 'tagfieldvalue' => 'div');
$allFormats['div'] = array('tagfield' => 'div', 'tagfieldname' => '', 'tagfieldvalue' => '');
$allFormats['p'] = array('tagfield' => 'p', 'tagfieldname' => '', 'tagfieldvalue' => '');
$allFormats['dd'] = array('tagfield' => '', 'tagfieldname' => 'dt', 'tagfieldvalue' => 'dd');
$currentFormat = '';
foreach ($allFormats as $oneFormat => $values) {
if (preg_match('#(name="' . $after . '".{0,' . $this->components[$option]['lengthafter'] . '}</' . $oneFormat . '>)#Uis', $body)) {
$currentFormat = $oneFormat;
break;
}
}
if (empty($currentFormat) && $severalValueTest) {
$i = 1;
while (empty($currentFormat) && $i < count($allAfters)) {
foreach ($allFormats as $oneFormat => $values) {
if (preg_match('#(name="' . $allAfters[$i] . '".{0,' . $this->components[$option]['lengthafter'] . '}</' . $oneFormat . '>)#Uis', $body)) {
$after = $allAfters[$i];
$currentFormat = $oneFormat;
break;
}
}
$i++;
}
}
if (empty($currentFormat)) {
if (JDEBUG) {
echo 'regAcyMailing plugin, could not find the right format to display the fields...';
}
return false;
}
$text = '';
if (!empty($this->components[$option]['labelclass'])) {
$fieldsClass->labelClass = $this->components[$option]['labelclass'];
}
if ($app->isAdmin()) {
$currentUserId = JRequest::getint('id', 0);
} else {
$user = JFactory::getUser();
$currentUserId = $user->id;
}
if (!empty($this->components[$option]['edittasks']) && in_array($this->view, $this->components[$option]['edittasks']) && $currentUserId != 0) {
$userClass = acymailing_get('class.subscriber');
$acyUserData = $userClass->get($userClass->subid($currentUserId));
}
foreach ($newOrdering as $fieldName) {
if (!empty($allFormats[$currentFormat]['tagfield'])) {
$text .= '<' . $allFormats[$currentFormat]['tagfield'] . ' id="acy' . $fieldName . '" class="acyregfield">';
}
if (!empty($allFormats[$currentFormat]['tagfieldname'])) {
$text .= '<' . $allFormats[$currentFormat]['tagfieldname'] . ' class="acyregfieldname' . (!empty($this->components[$option]['tdfieldlabelclass']) ? ' ' . $this->components[$option]['tdfieldlabelclass'] : '') . '">';
}
$text .= $fieldsClass->getFieldName($extraFields[$fieldName]);
if (!empty($allFormats[$currentFormat]['tagfieldname'])) {
$text .= '</' . $allFormats[$currentFormat]['tagfieldname'] . '>';
}
//.........这里部分代码省略.........
示例12: switchOwner
public function switchOwner()
{
FD::checkToken();
$view = $this->getCurrentView();
$ids = JRequest::getVar('ids');
$ids = FD::makeArray($ids);
$userId = JRequest::getint('userId');
if (empty($ids) || empty($userId)) {
$view->setMessage(JText::_('COM_EASYSOCIAL_EVENTS_SWITCH_OWNER_FAILED'), SOCIAL_MSG_ERROR);
return $view->call(__FUNCTION__);
}
foreach ($ids as $id) {
$event = FD::event($id);
$event->switchOwner($userId);
}
$view->setMessage(JText::_('COM_EASYSOCIAL_EVENTS_SWITCH_OWNER_SUCCESS'), SOCIAL_MSG_SUCCESS);
return $view->call(__FUNCTION__);
}
示例13: uddeIMgetItemidComponent
function uddeIMgetItemidComponent($component, $config) {
$database = uddeIMgetDatabase();
$gid = uddeIMgetGroupID2($config);
$sql="SELECT COUNT(id) FROM #__menu WHERE link LIKE '%".$component."%' AND published=1 AND access".($gid==0 ? "=" : "<=").$gid;
if (uddeIMcheckJversion()>=2) { // J1.6
$lang = JFactory::getLanguage();
$sql.=" AND language IN (" . $database->Quote($lang->get('tag')) . ",'*')";
}
$sql.=" LIMIT 1";
$database->setQuery($sql);
if ($component=="com_uddeim" &&
(int)$database->loadResult() > 1) {
$found = JRequest::getint('Itemid');
} else {
$sql="SELECT id FROM #__menu WHERE link LIKE '%".$component."%' AND published=1 AND access".($gid==0 ? "=" : "<=").$gid;
if (uddeIMcheckJversion()>=2) { // J1.6
$lang = JFactory::getLanguage();
$sql.=" AND language IN (" . $database->Quote($lang->get('tag')) . ",'*')";
}
$sql.=" LIMIT 1";
$database->setQuery($sql);
$found = (int)$database->loadResult();
}
// first try to find a published link
// $sql="SELECT id FROM #__menu WHERE link LIKE '%".$component."%' AND published=1 AND access".
// ($gid==0 ? "=" : "<=").$gid;
// if (uddeIMcheckJversion()>=2) { // J1.6
// $lang = JFactory::getLanguage();
// $sql.=" AND language IN (" . $database->Quote($lang->get('tag')) . ",'*')";
// }
// $sql.=" LIMIT 1";
// $database->setQuery($sql);
// $found = (int)$database->loadResult();
if (!$found) {
// when no published link has been found, try to find an unpublished one
$sql="SELECT id FROM #__menu WHERE link LIKE '%".$component."%' AND published=0 AND access".($gid==0 ? "=" : "<=").$gid;
if (uddeIMcheckJversion()>=2) { // J1.6
$lang = JFactory::getLanguage();
$sql.=" AND language IN (" . $database->Quote($lang->get('tag')) . ",'*')";
}
$sql.=" LIMIT 1";
$database->setQuery($sql);
$found = (int)$database->loadResult();
}
return $found;
}
示例14: generateRouteLink
public function generateRouteLink($link)
{
return JRoute::_($link . '&Itemid=' . JRequest::getint('Itemid'));
//return $link.'&Itemid='.JRequest::getint( 'Itemid' );
}
示例15: delImg
/**
* remove image
*/
function delImg()
{
jimport('joomla.filesystem.file');
$cid = JRequest::getVar('cid', array(), '', 'array');
$post = JRequest::get('post');
$imgId = JRequest::getint('imgId');
$imgName = JRequest::getVar('imgName');
//$proid = JRequest::getint('proid');
$db =& JFactory::getDBO();
if (!empty($imgId)) {
$query = 'DELETE FROM #__w_images WHERE id=' . $imgId . ' LIMIT 1';
$db->setQuery($query);
if (!$db->query()) {
JFile::delete(JPATH_SITE . DS . 'images' . DS . 'products' . DS . $imgName);
JFile::delete(JPATH_SITE . DS . 'images' . DS . 'products' . DS . 'thumbs' . DS . $imgName);
} else {
echo $db->getErrorMsg();
exit;
}
}
exit;
}