当前位置: 首页>>代码示例>>PHP>>正文


PHP Ajax类代码示例

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


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

示例1: showAllItems

 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}'>&nbsp;</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;
 }
开发者ID:nsautier,项目名称:positions,代码行数:30,代码来源:imageitem.class.php

示例2: showLogin

 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();
 }
开发者ID:uniteddiversity,项目名称:policat,代码行数:7,代码来源:actions.class.php

示例3: run

 /**
  * 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) . '&amp;popup=1';
     }
     // Prevent debug output at all cost.
     $GLOBALS['TL_CONFIG']['debugMode'] = false;
     $template->output();
 }
开发者ID:amenk,项目名称:dc-general,代码行数:60,代码来源:generaltree.php

示例4: __call

 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");
     }
 }
开发者ID:GGF,项目名称:baza4,代码行数:33,代码来源:secondlevel.class.php

示例5: displayContent

 /**
  * 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");');
 }
开发者ID:guancio,项目名称:Runalyze,代码行数:11,代码来源:class.RunalyzePluginTool_MultiEditor.php

示例6: getItems4Client

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('数据查询失败.');
    }
}
开发者ID:yyueshui,项目名称:taobaokedemo,代码行数:33,代码来源:api.php

示例7: sendGoogleCloudMessage

 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);
 }
开发者ID:kalpitpandit,项目名称:GCM-with-PHP-Google-Push-Notification-in-PHP-,代码行数:25,代码来源:Push.php

示例8: init

 /**
  * Init
  */
 public function init()
 {
     parent::init();
     if (Ajax::is()) {
         event('ajax.hashchange');
     }
 }
开发者ID:brussens,项目名称:cogear2,代码行数:10,代码来源:Gear.php

示例9: link

 /**
  * 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);
 }
开发者ID:n0rthface,项目名称:Runalyze,代码行数:17,代码来源:class.DataBrowserLinker.php

示例10: __construct

 public function __construct()
 {
     parent::__construct();
     //echo $_SESSION['test'];
     echo '<br>';
     $model = $this->loadAjaxModel('testmodel');
     print_r($model->korisnici());
 }
开发者ID:vkozinec,项目名称:debater,代码行数:8,代码来源:test.php

示例11: getRightSymbol

 /**
  * 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>';
 }
开发者ID:9x,项目名称:Runalyze,代码行数:12,代码来源:class.RunalyzePluginPanel_Sports.php

示例12: addInfoLink

 /**
  * 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);
     }
 }
开发者ID:n0rthface,项目名称:Runalyze,代码行数:11,代码来源:class.SectionLapsRowComputed.php

示例13: FieldFor

 /**
  * 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;
 }
开发者ID:rob-st,项目名称:Runalyze,代码行数:14,代码来源:FieldFactory.php

示例14: inlineDropdownWithRealLinks

 /**
  * @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;
 }
开发者ID:Strubbl,项目名称:Runalyze,代码行数:14,代码来源:Setting.php

示例15: tabDropdown

 public function tabDropdown()
 {
     global $CFG_GLPI;
     echo "<br><span id='tabstab'>&nbsp;</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);
     }
 }
开发者ID:paisdelconocimiento,项目名称:glpi-smartcities,代码行数:9,代码来源:defaulttab.class.php


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