本文整理汇总了PHP中N2Request::getInt方法的典型用法代码示例。如果您正苦于以下问题:PHP N2Request::getInt方法的具体用法?PHP N2Request::getInt怎么用?PHP N2Request::getInt使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类N2Request
的用法示例。
在下文中一共展示了N2Request::getInt方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: save
public function save()
{
$namespace = N2Request::getCmd('namespace', 'default');
$settings = N2Request::getVar('settings');
if ($namespace && $settings) {
if ($namespace == 'default') {
$namespace = 'settings';
}
if ($namespace == 'font' && N2Request::getInt('sliderid')) {
$namespace .= N2Request::getInt('sliderid');
self::markChanged(N2Request::getInt('sliderid'));
}
if ($namespace == 'joomla') {
$license = empty($settings['license']) ? '' : $settings['license'];
$updates = $this->db->queryAll("SELECT b.update_site_id FROM " . $this->db->tableAlias("extensions") . " AS a LEFT JOIN " . $this->db->tableAlias("update_sites_extensions") . " AS b ON a.extension_id = b.extension_id WHERE a.element = 'com_smartslider3'");
if (count($updates)) {
$id = $updates[0]['update_site_id'];
unset($updates[0]);
if (count($updates)) {
foreach ($updates as $u) {
$this->db->setTableName("update_sites");
$this->db->deleteByAttributes(array("update_site_id" => $u['update_site_id']));
$this->db->setTableName("update_sites_extensions");
$this->db->deleteByAttributes(array("update_site_id" => $u['update_site_id']));
}
}
$this->db->setTableName("update_sites");
$this->db->update(array("location" => 'http://www.nextendweb.com/update2/joomla/update.php?license=' . urlencode($license) . '&fake=extension.xml'), array("update_site_id" => $id));
}
}
N2SmartSliderSettings::store($namespace, json_encode($settings));
}
}
示例2: actionEdit
public function actionEdit()
{
$this->validateToken();
$this->validatePermission('smartslider_edit');
if (N2Request::getInt('save')) {
$slidersModel = new N2SmartsliderSlidersModel();
$slider = $slidersModel->get(N2Request::getInt('sliderid'));
$this->validateDatabase($slider);
if ($sliderid = $slidersModel->save($slider['id'], N2Request::getVar('slider'))) {
N2Message::success(n2_('Slider saved.'));
$this->response->respond();
}
}
$response = null;
$id = N2Request::getCmd('id');
$ajaxModel = new N2SmartSliderAjaxModel();
ob_start();
switch ($id) {
case 'slidertype':
$response = $ajaxModel->sliderType($this->appType);
break;
case 'sliderresponsivemode':
$response = $ajaxModel->sliderResponsiveMode($this->appType);
break;
case 'sliderwidgetarrow':
$response = $ajaxModel->sliderWidget($this->appType, 'arrow');
break;
case 'sliderwidgetbullet':
$response = $ajaxModel->sliderWidget($this->appType, 'bullet');
break;
case 'sliderwidgetautoplay':
$response = $ajaxModel->sliderWidget($this->appType, 'autoplay');
break;
case 'sliderwidgetindicator':
$response = $ajaxModel->sliderWidget($this->appType, 'indicator');
break;
case 'sliderwidgetfullscreen':
$response = $ajaxModel->sliderWidget($this->appType, 'fullscreen');
break;
case 'sliderwidgetbar':
$response = $ajaxModel->sliderWidget($this->appType, 'bar');
break;
case 'sliderwidgetthumbnail':
$response = $ajaxModel->sliderWidget($this->appType, 'thumbnail');
break;
case 'sliderwidgetshadow':
$response = $ajaxModel->sliderWidget($this->appType, 'shadow');
break;
case 'sliderwidgethtml':
$response = $ajaxModel->sliderWidget($this->appType, 'html');
break;
}
if ($response == null) {
$response = array('html' => '', 'script' => '');
}
$response['html'] .= ob_get_clean();
$this->response->respond($response);
}
示例3: actionRecordsTable
public function actionRecordsTable()
{
$this->validateToken();
$this->validatePermission('smartslider_edit');
$generatorId = N2Request::getInt('generator_id');
$generatorModel = new N2SmartsliderGeneratorModel();
if ($generatorId > 0) {
$generator = $generatorModel->get($generatorId);
$this->validateDatabase($generator);
} else {
$info = new N2Data(N2Request::getVar('generator'));
$generator = array('group' => $info->get('group'), 'type' => $info->get('type'), 'params' => '{}');
}
$info = $generatorModel->getGeneratorInfo($generator['group'], $generator['type']);
$generator['params'] = new N2Data($generator['params'], true);
$generator['params']->loadArray(N2Request::getVar('generator'));
require_once $info->path . '/generator.php';
$class = 'N2Generator' . $generator['group'] . $generator['type'];
/** @var N2GeneratorAbstract $dataSource */
$dataSource = new $class($info, $generator['params']);
$request = new N2Data(N2Request::getVar('generator'));
$group = max(intval($request->get('record-group', 1)), 1);
$result = $dataSource->getData(max($request->get('record-slides', 1), 1), max($request->get('record-start', 1), 1), $group);
if (count($result)) {
ob_start();
$headings = array();
for ($i = 1; $i <= $group; $i++) {
$headings[] = '#';
foreach ($result[0][0] as $k => $v) {
$headings[] = '{' . $k . '/' . $i . '}';
}
}
$headingHTML = N2Html::tag('thead', array(), N2Html::tag('tr', array(), '<th>' . implode('</th><th>', $headings) . '</th>'));
$rows = array();
$i = 0;
foreach ($result as $records) {
foreach ($records as $g => $record) {
$rows[$i][] = $i + 1;
foreach ($record as $k => $v) {
$rows[$i][] = N2Html::tag('div', array(), htmlentities($v));
}
}
$i++;
}
for ($i = 0; $i < count($rows); $i++) {
$rows[$i] = '<td>' . implode('</td><td>', $rows[$i]) . '</td>';
}
$recordHTML = N2Html::tag('tbody', array(), '<tr>' . implode('</tr><tr>', $rows) . '</tr>');
echo N2Html::tag('div', array('style' => 'width: 100%; height: 100%; overflow: auto;'), N2Html::tag('table', array('class' => 'n2-generator-records n2-table n2-table-fancy', 'style' => 'margin: 10px; width: auto; table-layout: fixed;'), $headingHTML . $recordHTML));
$this->response->respond(array('html' => ob_get_clean()));
} else {
N2Message::notice('No records found for the filter');
$this->response->error();
}
}
示例4: actionDuplicate
public function actionDuplicate()
{
if ($this->validateToken() && $this->validatePermission('smartslider_edit')) {
$slidersModel = new N2SmartsliderSlidersModel();
if (($sliderid = N2Request::getInt('sliderid')) && $slidersModel->get($sliderid)) {
$newSliderId = $slidersModel->duplicate($sliderid);
N2Message::success(n2_('Slider duplicated.'));
$this->redirect(array("slider/edit", array("sliderid" => $newSliderId)));
}
$this->redirectToSliders();
}
}
示例5: actionChangeVisual
public function actionChangeVisual()
{
$this->validateToken();
$visualId = N2Request::getInt('visualId');
$this->validateVariable($visualId > 0, 'image');
$model = $this->getModel();
if ($visual = $model->changeVisual($visualId, N2Request::getVar('value'))) {
$this->response->respond(array('visual' => $visual));
}
N2Message::error(n2_('Unexpected error'));
$this->response->error();
}
示例6: actionGenerator
public function actionGenerator()
{
if ($this->validateToken() && $this->validatePermission('smartslider_edit')) {
$generator_id = N2Request::getInt('generator_id');
$generatorModel = new N2SmartsliderGeneratorModel();
$sliderId = $generatorModel->getSliderId($generator_id);
if ($sliderId) {
$generatorData = array();
$generatorData[$generator_id] = N2Request::getVar('generator');
$this->addView("generator", array('generatorData' => $generatorData, 'sliderId' => $sliderId));
$this->render();
}
}
}
示例7: actionItemDefaults
public function actionItemDefaults()
{
if ($this->validatePermission('smartslider_config')) {
if (N2Request::getInt('save')) {
if ($this->validateToken()) {
$settingsModel = new N2SmartsliderSettingsModel();
if ($settingsModel->saveDefaults(N2Request::getVar('defaults', array()))) {
$this->refresh();
}
} else {
$this->refresh();
}
}
$this->addView("../../inline/_sidebar_settings", array(), "sidebar");
$this->addView("defaults");
$this->render();
}
}
示例8: array
<?php
/**
* @var $slidesModel N2SmartsliderSlidesModel
*/
$slide = $slidesModel->get(N2Request::getInt('slideid', 0));
$actions = array(N2Html::tag('a', array('href' => $this->appType->router->createUrl(array("slider/edit", array("sliderid" => $sliderId))), 'class' => 'n2-button n2-button-red n2-button-big n2-h4 n2-b n2-uc', 'onclick' => 'return nextend.cancel(this.href);'), n2_('Cancel')));
if ($slide && $slide['generator_id'] > 0) {
$actions[] = N2Html::tag('a', array('href' => '#', 'class' => 'n2-button n2-button-blue n2-button-big n2-h4 n2-b n2-uc', 'onclick' => 'nextend.askToSave = false;setTimeout(function() {var static = n2("<input name=\'static\' value=\'1\' />"); n2(\'#smartslider-form\').append(static).submit(); static.remove();}, 300); return false;'), n2_('Static save'));
}
$actions[] = N2Html::tag('a', array('href' => '#', 'class' => 'n2-button n2-button-green n2-button-big n2-h4 n2-b n2-uc', 'onclick' => 'return NextendForm.submit("#smartslider-form");'), n2_('Save'));
$this->widget->init('topbar', array('back' => N2Html::tag('a', array('class' => 'n2-h4 n2-uc', 'href' => $this->appType->router->createUrl(array("slider/edit", array("sliderid" => $sliderId)))), n2_('Slider settings')), "actions" => $actions, 'menu' => array(N2Html::tag('a', array('id' => 'n2-ss-preview', 'href' => '#', 'class' => 'n2-h3 n2-uc n2-has-underline n2-button n2-button-blue n2-button-big', 'style' => 'font-size: 12px;'), n2_('Preview')), N2Html::tag('a', array('id' => 'n2-ss-undo', 'href' => '#', 'class' => 'n2-h3 n2-uc n2-has-underline n2-button n2-button-grey n2-button-big n2-icon-button', 'style' => 'font-size: 12px;'), '<i class="n2-i n2-it n2-i-16 n2-i-undo"></i>'), N2Html::tag('a', array('id' => 'n2-ss-redo', 'href' => '#', 'class' => 'n2-h3 n2-uc n2-has-underline n2-button n2-button-grey n2-button-big n2-icon-button', 'style' => 'font-size: 12px;'), '<i class="n2-i n2-it n2-i-16 n2-i-redo"></i>')), "hideSidebar" => true));
?>
<script type="text/javascript">
nextend.isPreview = false;
nextend.ready(
function ($) {
var form = $('#smartslider-form'),
formAction = form.attr('action');
var modal = new NextendSimpleModal('<iframe name="n2-tab-preview" src="" style="width: 100%;height:100%;"></iframe>');
modal.modal.on('ModalHide', function () {
modal.modal.find('iframe').attr('src', 'about:blank');
$(window).trigger('SSPreviewHide');
});
$('#n2-ss-preview').on('click', function (e) {
nextend.isPreview = true;
e.preventDefault();
示例9: isAjaxCall
/**
* @return bool
*/
public function isAjaxCall()
{
return N2Request::getInt('nextendajax');
}
示例10: isCurrentlyEdited
public function isCurrentlyEdited()
{
return N2Request::getInt('slideid') == $this->id;
}
示例11: _renderGroupOption
public function _renderGroupOption($group, $sources)
{
$options = array();
foreach ($sources as $type => $info) {
/**
* @var $info N2GeneratorInfo
*/
$options[$type] = $info->title;
if ($info->hasConfiguration) {
$button = N2Html::link("Next", $this->appType->router->createUrl(array("generator/checkConfiguration", array("sliderid" => N2Request::getInt('sliderid'), "group" => $group))), array("onclick" => "var el = n2(this); el.attr('href', el.attr('href') + '&type='+el.parents('.n2-box-placeholder').find('select').val());", "class" => "n2-button n2-button-small n2-button-blue"));
} elseif (!$info->installed) {
$button = N2Html::link("Check extension", $info->readMore, array("target" => "_blank", "class" => "n2-button n2-button-small n2-button-grey"));
} else {
$button = N2Html::link("Next", $this->appType->router->createUrl(array("generator/createSettings", array("sliderid" => N2Request::getInt('sliderid'), "group" => $group))), array("onclick" => "var el = n2(this); el.attr('href', el.attr('href') + '&type='+el.parents('.n2-box-placeholder').find('select').val());", "class" => "n2-button n2-button-small n2-button-blue"));
}
}
$optionsHTML = '';
foreach ($options as $k => $v) {
$optionsHTML .= N2Html::tag('option', array('value' => $k), $v);
}
echo N2Html::tag('div', array('class' => 'n2-box'), N2Html::image(N2Uri::pathToUri(N2Filesystem::translate($info->path . '/../dynamic.png'))) . N2Html::tag("div", array('class' => 'n2-box-placeholder'), N2Html::tag("table", array(), N2Html::tag("tr", array(), N2Html::tag("td", array('class' => 'n2-box-label'), N2Html::tag('select', array('name' => 'generator-type'), $optionsHTML)) . N2Html::tag("td", array('class' => 'n2-box-button'), $button)))));
}
示例12: makeSlides
public function makeSlides($extend = array())
{
if (N2Request::getCmd('nextendcontroller') == 'slides') {
$slides =& $this->slides;
if (N2Request::getCmd('nextendaction') == 'create') {
if ($this->maximumSlideCount > 0) {
array_splice($slides, $this->maximumSlideCount - 1);
}
$staticSlide = N2Request::getInt('static', 0);
$slide = $this->createSlide(array('id' => 0, 'title' => 'Title', 'slider' => N2Request::getInt('sliderid'), 'publish_up' => '0000-00-00 00:00:00', 'publish_down' => '0000-00-00 00:00:00', 'published' => 1, 'first' => 0, 'slide' => '', 'description' => '', 'thumbnail' => '', 'background' => 'ffffff00|*|', 'params' => json_encode(array('static-slide' => $staticSlide)), 'ordering' => count($slides), 'generator_id' => 0));
if ($slide->isStatic()) {
$this->slider->addStaticSlide($slide);
if (count($slides) == 0) {
$slide2 = $this->createSlide(array('id' => 0, 'title' => 'Title', 'slider' => N2Request::getInt('sliderid'), 'publish_up' => '0000-00-00 00:00:00', 'publish_down' => '0000-00-00 00:00:00', 'published' => 1, 'first' => 0, 'slide' => '', 'description' => '', 'thumbnail' => '', 'background' => 'ffffff00|*|', 'params' => '', 'ordering' => count($slides), 'generator_id' => 0));
array_push($slides, $slide2);
}
} else {
for ($i = 0; $i < count($slides); $i++) {
if ($slides[$i]->isStatic()) {
$this->slider->addStaticSlide($slides[$i]);
array_splice($slides, $i, 1);
$i--;
}
}
array_push($slides, $slide);
$this->slider->_activeSlide = count($slides) - 1;
}
} else {
$currentlyEdited = N2Request::getInt('slideid');
$currentlyEditedSlide = null;
$isStatic = false;
for ($i = 0; $i < count($slides); $i++) {
if ($slides[$i]->isStatic()) {
if ($slides[$i]->id == $currentlyEdited) {
$isStatic = true;
}
$this->slider->addStaticSlide($slides[$i]);
array_splice($slides, $i, 1);
$i--;
}
}
if ($isStatic) {
for ($i = 0; $i < count($this->slider->staticSlides); $i++) {
if ($this->slider->staticSlides[$i]->id != $currentlyEdited) {
array_splice($this->slider->staticSlides, $i, 1);
$i--;
}
}
}
for ($i = 0; $i < count($slides); $i++) {
$slides[$i]->initGenerator($extend);
}
for ($i = count($slides) - 1; $i >= 0; $i--) {
if ($slides[$i]->hasGenerator()) {
array_splice($slides, $i, 1, $slides[$i]->expandSlide());
}
}
if (!$isStatic) {
for ($i = 0; $i < count($slides); $i++) {
if ($slides[$i]->id == $currentlyEdited) {
$this->slider->_activeSlide = $i;
$currentlyEditedSlide = $slides[$i];
break;
}
}
} else {
if (count($slides) == 0) {
if (count($slides) == 0) {
$slide2 = $this->createSlide(array('id' => 0, 'title' => 'Title', 'slider' => N2Request::getInt('sliderid'), 'publish_up' => '0000-00-00 00:00:00', 'publish_down' => '0000-00-00 00:00:00', 'published' => 1, 'first' => 0, 'slide' => '', 'description' => '', 'thumbnail' => '', 'background' => 'ffffff00|*|', 'params' => '', 'ordering' => count($slides), 'generator_id' => 0));
array_push($slides, $slide2);
}
}
$this->slider->_activeSlide = 0;
$currentlyEditedSlide = $slides[0];
}
if ($this->maximumSlideCount > 0) {
array_splice($slides, $this->maximumSlideCount);
$found = false;
for ($i = 0; $i < count($slides); $i++) {
if ($slides[$i] == $currentlyEditedSlide) {
$found = true;
break;
}
}
if (!$found) {
$this->slider->_activeSlide = count($slides) - 1;
$slides[$this->slider->_activeSlide] = $currentlyEditedSlide;
}
}
if ($currentlyEditedSlide) {
$currentlyEditedSlide->setCurrentlyEdited();
}
}
}
}
示例13: unPublish
public function unPublish($id)
{
$this->db->update(array("published" => 0), array("id" => intval($id)));
self::markChanged(N2Request::getInt('sliderid'));
}
示例14: actionUnPublish
public function actionUnPublish()
{
if ($this->validateToken() && $this->validatePermission('smartslider_edit')) {
if ($slideId = N2Request::getInt('slideid')) {
$slidesModel = new N2SmartsliderSlidesModel();
$slidesModel->unpublish($slideId);
$this->redirect(N2Request::getUrlReferrer());
}
$this->redirect(array("sliders/index"));
}
}
示例15: actionConfigure
public function actionConfigure($create = false)
{
if ($this->validatePermission('smartslider_config')) {
$generatorModel = new N2SmartsliderGeneratorModel();
$group = N2Request::getVar('group');
$type = N2Request::getVar('type');
$info = $generatorModel->getGeneratorInfo($group, $type);
$configuration = $info->getConfiguration();
if (N2Request::getInt('save')) {
if ($this->validateToken()) {
$configuration->addData(N2Request::getVar('generator'));
$this->refresh();
} else {
$this->refresh();
}
}
$this->addView("../../inline/_sidebar_settings", array(), "sidebar");
if ($create == false || !$configuration->wellConfigured()) {
$this->addView("check_configuration", array('configuration' => $configuration));
$this->render();
} else {
$this->redirect(array("generator/createsettings", array("sliderid" => N2Request::getInt('sliderid'), "group" => $group, "type" => $type)), 302, true);
}
}
}