static function showAllItems($myname, $value_type = 0, $value = 0, $entity_restrict = -1, $types, $locations_id = -1, $action = 'showItem') { global $DB, $CFG_GLPI; $rand = mt_rand(); $plugin = new Plugin(); echo "<table border='0'><tr><td>\n"; if ($myname == 'type') { $newtypes = array_flip($types); unset($newtypes['Location']); unset($newtypes['Netpoint']); if ($plugin->isActivated("resources")) { unset($newtypes['PluginResourcesResource']); } $types = array_flip($newtypes); } $rand = Dropdown::showItemTypes($myname, $types, array('emptylabel' => Dropdown::EMPTY_VALUE, 'width' => 150)); $params = array('type' => '__VALUE__', 'value' => $value, 'myname' => $myname, 'action' => $action, 'entity_restrict' => $entity_restrict, 'locations_id' => $locations_id); Ajax::updateItemOnSelectEvent("dropdown_{$myname}{$rand}", "show_{$myname}{$rand}", $CFG_GLPI["root_doc"] . "/plugins/positions/ajax/dropdownAllItems.php", $params); echo "</td><td>\n"; echo "<span id='show_{$myname}{$rand}'> </span>\n"; echo "</td></tr></table>\n"; if ($value > 0) { echo "<script type='text/javascript' >\n"; echo "document.getElementById('item_type{$rand}').value='" . $value_type . "';"; echo "</script>\n"; $params["typetable"] = $value_type; Ajax::updateItem("show_{$myname}{$rand}", $CFG_GLPI["root_doc"] . "/plugins/positions/ajax/dropdownAllItems.php", $params); } return $rand; }
protected function showLogin() { $ajax = new Ajax($this); $class = sfConfig::get('app_sf_guard_plugin_signin_form', 'sfGuardFormSignin'); $this->form = new $class(); return $ajax->appendPartial('body', 'account/ajaxSignin')->modal('#login_modal')->alert('Please signin.', 'Session timeout.', '#login_modal .modal-body', 'prepend')->render(); }
/** * Run the controller and parse the template. * * @return void */ public function run() { $template = new \BackendTemplate('be_picker'); $template->main = ''; // Ajax request. // @codingStandardsIgnoreStart - We need POST access here. if ($_POST && \Environment::get('isAjaxRequest')) { $ajax = new \Ajax(\Input::post('action')); $ajax->executePreActions(); } $strTable = \Input::get('table'); $strField = \Input::get('field'); // Define the current ID. define('CURRENT_ID', $strTable ? \Session::getInstance()->get('CURRENT_ID') : \Input::get('id')); $dispatcher = $GLOBALS['container']['event-dispatcher']; /** @var \Symfony\Component\EventDispatcher\EventDispatcher $dispatcher */ $propagator = new EventPropagator($dispatcher); $translator = new TranslatorChain(); $translator->add(new LangArrayTranslator($dispatcher)); $factory = new DcGeneralFactory(); $this->itemContainer = $factory->setContainerName($strTable)->setTranslator($translator)->setEventPropagator($propagator)->createDcGeneral(); $information = (array) $GLOBALS['TL_DCA'][$strTable]['fields'][$strField]; // Merge with the information from the data container. $property = $this->itemContainer->getEnvironment()->getDataDefinition()->getPropertiesDefinition()->getProperty($strField); $extra = $property->getExtra(); $information['eval']['sourceName'] = $extra['sourceName']; $information['eval']['fieldType'] = $extra['fieldType']; /** @var \ContaoCommunityAlliance\DcGeneral\Contao\View\Contao2BackendView\TreePicker $objTreeSelector */ $objTreeSelector = new $GLOBALS['BE_FFL']['DcGeneralTreePicker'](\Widget::getAttributesFromDca($information, $strField, array_filter(explode(',', \Input::get('value'))), $strField, $strTable, new DcCompat($this->itemContainer->getEnvironment()))); // AJAX request. if (isset($ajax)) { $objTreeSelector->generateAjax(); $ajax->executePostActions(new DcCompat($this->itemContainer->getEnvironment())); } $template->main = $objTreeSelector->generatePopup(); $template->theme = \Backend::getTheme(); $template->base = \Environment::get('base'); $template->language = $GLOBALS['TL_LANGUAGE']; $template->title = specialchars($GLOBALS['TL_LANG']['MSC']['treepicker']); $template->charset = $GLOBALS['TL_CONFIG']['characterSet']; $template->addSearch = $objTreeSelector->searchField; $template->search = $GLOBALS['TL_LANG']['MSC']['search']; $template->action = ampersand(\Environment::get('request')); $template->value = \Session::getInstance()->get($objTreeSelector->getSearchSessionKey()); $template->manager = $GLOBALS['TL_LANG']['MSC']['treepickerManager']; $template->breadcrumb = $GLOBALS['TL_DCA'][$objTreeSelector->foreignTable]['list']['sorting']['breadcrumb']; $template->managerHref = ''; // Add the manager link. if ($objTreeSelector->managerHref) { $template->managerHref = 'contao/main.php?' . ampersand($objTreeSelector->managerHref) . '&popup=1'; } // Prevent debug output at all cost. $GLOBALS['TL_CONFIG']['debugMode'] = false; $template->output(); }
public function __call($name, $arguments) { try { $replaced = 0; $act = str_replace('action_', '', $name, $replaced); if ($replaced == 0) { throw new Exception("Нет такого метода {$name}"); } $act = $this->getName() . "_" . $act; if (class_exists($act)) { $this->table = new $act(); } else { $this->table = new sqltable($act); } if ($this->table == null) { throw new Exception("Не возможно создать такую таблицу {$act}"); } } catch (Exception $e) { return $this->_404("[class=" . get_class($this) . "] : " . $e->getMessage()); } if ($arguments[nooutput]) { return; } if ($this->table->run()) { if (Ajax::isAjaxRequest()) { return $this->table->getOutput(); } $this->setOutputAssigns(); Output::assign('menu', $this->getIndexMenu()); Output::setContent($this->table->getOutput()); return $this->fetch("body_base.tpl"); } }
/** * Display the content * @see PluginPanel::displayContent() */ protected function displayContent() { $this->initData(); $MultiEditor = new MultiEditor($this->IDs); $MultiEditor->display(); echo Ajax::wrapJS('$("#ajax").addClass("small-window");'); }
function getItems4Client() { $DB = new PDO('mysql:host=' . DB_HOST . ';dbname=' . DB_NAME, DB_USERNAME, DB_PASSWORD); $table = DB_TABLE; //检查一下是否存在表 $sql = "SHOW TABLES LIKE '%{$table}%';"; $rc = $DB->query($sql)->rowCount(); if (!$rc) { $sqlFile = file_get_contents('items.sql'); $DB->exec($sqlFile); } $sql = "SELECT * FROM `{$table}` LIMIT 0,10"; $query = $DB->query($sql); $query->setFetchMode(PDO::FETCH_ASSOC); $rt = $query->fetchAll(); if ($rt) { $items = array(); foreach ($rt as $item) { $tmp = array(); $tmp['openid'] = $item['tb_item_id']; $tmp['iid'] = $item['tb_iid']; $tmp['price'] = $item['price'] ? $item['price'] / 100 : $item['reserve_price'] / 100; $tmp['name'] = $item['name']; $tmp['pic'] = $item['pic']; $tmp['itemType'] = $item['is_mall'] + 1; // 客户端判断是 1:集市店,2:天猫店 $items[] = $tmp; } Ajax::go($items); } else { Ajax::error('数据查询失败.'); } }
public static function Instance() { if (self::$_instance === null) { self::$_instance = new self(); } return self::$_instance; }
public function sendGoogleCloudMessage($data) { // GCM url $url = 'https://android.googleapis.com/gcm/send'; // Message goes here $msg = array('message' => array('name' => $data['name'], 'message' => $data['message'], 'location' => $data['location'])); // Device id where we want to send notification $ids = array($data['apid']); $post = array('registration_ids' => $ids, 'data' => $msg, 'time_to_live' => 15); // Applicaiton registration key $headers = array('Authorization: key=' . $this->apikey, 'Content-Type: application/json'); // Hiting GCM api via CURL.. $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_POST, true); curl_setopt($ch, CURLOPT_HTTPHEADER, $headers); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($post)); $result = curl_exec($ch); if (curl_errno($ch)) { Ajax::error(curl_errno($ch)); } print_r($ch); curl_close($ch); }
/** * Init */ public function init() { parent::init(); if (Ajax::is()) { event('ajax.hashchange'); } }
/** * Get a ajax-link to a specified DataBrowser * @param string $name Name to be displayed as link * @param int $start Timestamp for first date in browser * @param int $end Timestamp for last date in browser * @param string $title title for the link * @param string $rel * @return string HTML-link */ static function link($name, $start, $end, $title = '', $rel = '') { if (FrontendShared::$IS_SHOWN) { return DataBrowserShared::getLink($name, $start, $end, $title = ''); } $href = 'call/call.DataBrowser.display.php?start=' . $start . '&end=' . $end; return Ajax::link($name, DATA_BROWSER_ID, $href, $rel, $title); }
public function __construct() { parent::__construct(); //echo $_SESSION['test']; echo '<br>'; $model = $this->loadAjaxModel('testmodel'); print_r($model->korisnici()); }
/** * Method for getting the right symbol(s) * @see PluginPanel::getRightSymbol() */ protected function getRightSymbol() { $html = '<ul>'; foreach ($this->getTimeset() as $i => $timeset) { $html .= '<li>' . Ajax::change($timeset['name'], 'sports', '#sports_' . $i) . '</li>'; } return $html . '</ul>'; }
/** * Add info link */ protected function addInfoLink() { if (!Request::isOnSharedPage()) { $Linker = new Linker($this->Context->activity()); $InfoLink = Ajax::window('<a href="' . $Linker->urlToRoundsInfo() . '">' . __('More details about your laps') . '</a>', 'normal'); $this->Header = HTML::info($InfoLink); } }
/** * Add field * @param \Runalyze\Configuration\Handle $Handle * @param array $options * @return \FormularField */ public function FieldFor(Handle $Handle, array $options = array()) { $options = array_merge(array('label' => $Handle->key(), 'tooltip' => '', 'unit' => '', 'size' => '', 'css' => '', 'layout' => ''), $options); $label = !empty($options['tooltip']) ? \Ajax::tooltip($options['label'], $options['tooltip']) : $options['label']; $Field = $this->createFieldFor($Handle, $label); $this->setAttributesToField($Field, $options); return $Field; }
/** * @param \Runalyze\Dataset\Context $context * @return string * @codeCoverageIgnore */ protected function inlineDropdownWithRealLinks(Context $context) { $id = $context->activity()->id(); $html = '<li>' . \Ajax::window('<a href="' . $context->linker()->editUrl() . '">' . \Icon::$EDIT . ' ' . __('Edit') . '</a> ', 'small') . '</li>'; $html .= '<li><span class="link" data-action="privacy" data-activityid="' . $id . '">' . $this->privacyIconAndLabel($context) . '</span></li>'; $html .= '<li><span class="link" data-action="delete" data-activityid="' . $id . '" data-confirm="' . __('Do you really want to delete this activity?') . '"><i class="fa fa-fw fa-trash"></i> ' . __('Delete activity') . '</span></li>'; $html .= $context->activity()->isPublic() ? '<li><a href="' . $context->linker()->publicUrl() . '" target="_blank" onclick="(arguments[0] || window.event).stopPropagation();">' . \Icon::$ATTACH . ' ' . __('Public link') . '</a></li>' : ''; return $html; }
public function tabDropdown() { global $CFG_GLPI; echo "<br><span id='tabstab'> </span>\n"; if ($this->fields['id'] > 0) { $params = array('itemtype' => $this->fields['itemtype'], 'myname' => 'tabstab', 'value' => $this->fields['tab'], 'id' => $this->fields['id']); Ajax::updateItem('tabstab', $CFG_GLPI["root_doc"] . "/plugins/custom/ajax/dropdowntab.php", $params); } }
/** * Add info link */ protected function addInfoLink() { if ($this->Context->trackdata()->has(Trackdata\Entity::DISTANCE) && $this->Context->trackdata()->has(Trackdata\Entity::TIME)) { if (!Request::isOnSharedPage()) { $Linker = new Linker($this->Context->activity()); $InfoLink = Ajax::window('<a href="' . $Linker->urlToRoundsInfo() . '">' . __('More details about your laps') . '</a>', 'big'); $this->Header = HTML::info($InfoLink); } } }
/** * Get link to shared list for current user * @param string $text [optional] * @return string */ public static function getListLinkForCurrentUser($text = null) { if (!Configuration::Privacy()->listIsPublic()) { return ''; } if (is_null($text)) { $text = Icon::$ATTACH; } return '<a href="shared/' . SessionAccountHandler::getUsername() . '/" target="_blank" ' . Ajax::tooltip('', __('Public list'), false, true) . '>' . $text . '</a>'; }
/** * Add info link */ protected function addInfoLink() { if ($this->Context->dataview()->vdot()->value() > 0 || $this->Context->activity()->jdIntensity() > 0) { if (!Request::isOnSharedPage()) { $Linker = new Activity\Linker($this->Context->activity()); $InfoLink = Ajax::window('<a href="' . $Linker->urlToVDOTInfo() . '">' . __('More about VDOT calculation') . '</a>', 'small'); $this->Footer = HTML::info($InfoLink); } } }
/** * Display after insert */ public function displayAfterInsert() { if ($this->EditorRequested) { $MultiEditor = new MultiEditor($this->InsertedIDs); $MultiEditor->display(); } else { echo HTML::em(__('The activities have been successfully imported.')); echo Ajax::closeOverlay(); } }
/** * Display change menu */ private function displayChangeMenu() { if (count($this->RowsTabbedTitle) <= 1) { return; } echo '<div class="change-menu">'; foreach ($this->RowsTabbedTitle as $i => $Title) { echo Ajax::change($Title, 'training-view-tabbed-' . $this->cssId(), 'training-view-tabbed-' . $this->cssId() . '-' . $i); } echo '</div>'; }
public function action_help() { if (Ajax::isAjaxRequest()) { return $this->fetch("help.tpl"); } else { CTitle::addSection('Помощь'); $this->setOutputAssigns(); Output::assign('menu', $this->getIndexMenu()); Output::setContent($this->fetch("help.tpl")); return $this->fetch("body_base.tpl"); } }
/** * Display header */ protected function displayHeader() { $name = $this->Plugin instanceof PluginTool ? $this->Plugin->getWindowLink() : $this->Plugin->name(); $Links = array(); $Links[] = array('tag' => Ajax::window('<a href="' . ConfigTabPlugins::getExternalUrl() . '">' . __('back to overview') . '</a>')); echo '<div class="panel-heading">'; echo '<div class="panel-menu">'; echo Ajax::toolbarNavigation($Links); echo '</div>'; echo '<h1>' . __('Plugin configuration') . ': ' . $name . '</h1>'; echo '</div>'; }
public function handleRequest() { $path = $this->getRequestUriAsArray(); // ajax extension will handle ajax Requests $ajax = Ajax::getInstance(); if (Ajax::isAjaxRequest()) { $ajax->enableAjaxErrorHandling(); $ajax->handleRequest($path); } else { $indexExtensions = $this->getExtensionByType("IIndexExtension"); $indexExtensions[0]->handleRequest($path); } }
public function action_blocks() { $_SESSION[customer_id] = ''; $this->table = new orders_blocks(); if ($this->table->run()) { if (Ajax::isAjaxRequest()) { return $this->table->getOutput(); } $this->setOutputAssigns(); Output::assign('menu', $this->getIndexMenu()); Output::setContent($this->table->getOutput()); return $this->fetch("body_base.tpl"); } }
/** * Display change menu */ private function displayChangeMenu() { if (count($this->Links) <= 1) { return; } echo '<div class="change-menu">'; foreach ($this->Links as $key => $Title) { echo Ajax::change($Title, 'training-view-tabbed-' . $this->cssId(), 'training-view-tabbed-' . $this->cssId() . '-' . $key); } if (count($this->Links) > 1) { echo Ajax::change('<i class="fa fa-fw fa-bars"></i> ' . __('All'), 'training-view-tabbed-' . $this->cssId(), 'training-view-tabbed-' . $this->cssId()); } echo '</div>'; }
/** * Add info link */ protected function addInfoLink() { if (!Request::isOnSharedPage()) { $Linker = new Linker($this->Context->activity()); $InfoLink = Ajax::window('<a href="' . $Linker->urlToElevationInfo() . '">' . __('More about elevation') . '</a>', 'normal'); $this->Footer = HTML::info($InfoLink); } else { $this->Footer = ''; } if ($this->Context->route()->hasCorrectedElevations()) { $this->Footer .= HTML::info(__('Elevation data were corrected.')); } elseif ($this->Context->route()->hasOriginalElevations() && Configuration::ActivityForm()->correctElevation()) { $this->Footer .= HTML::warning(__('Elevation data are not corrected.')); } // TODO: Add link to correct them now! }
/** * Method for getting the right symbol(s) */ protected function getRightSymbol() { $Links = ''; $Links .= '<li class="with-submenu"><span class="link">' . __('Choose time range') . '</span>'; $Links .= '<ul class="submenu">'; foreach ($this->Timeset as $i => $timeset) { $Link = Ajax::change($timeset['name'], 'sports', '#sports_' . $i); if ($i == $this->DefaultTimesetIndex) { $Link = Ajax::insertClass($Link, 'triggered'); } $Links .= '<li>' . $Link . '</li>'; } $Links .= '</ul>'; $Links .= '</li>'; return '<ul>' . $Links . '</ul>'; }
function Handle() { $ajax = Ajax::Instance(); if ($this->Validate()) { try { $this->_process(); $ajax->setSuccessResponse($this->_response); } catch (Exception $ex) { $this->_response = array("response" => array("message" => array("Request couldn't be submitted. " . $ex->getMessage()))); $ajax->setErrorResponse($this->_response); } } else { $ajax->setErrorResponse($this->_response); } $ajax->renderJSONResponse(); }
public function __call($name, $arguments) { $arguments[nooutput] = true; parent::__call($name, $arguments); $this->need_yaer_arc = $this->table->model->getNeedArc(); //console::getInstance()->out("lss=".Auth::$lss." ".print_r($_SESSION,true)); if ($this->table->run()) { if (Ajax::isAjaxRequest()) { return $this->table->getOutput(); } $this->setOutputAssigns(); Output::assign('menu', $this->getIndexMenu()); Output::setContent($this->table->getOutput()); return $this->fetch("body_base.tpl"); } }