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


PHP DataProvider类代码示例

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


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

示例1: render

 public function render()
 {
     $value = 0;
     $value_id = 0;
     $aDataSource = $this->getDataSource();
     $aDataSource[2]['Criteria']['ParentId'] = 0;
     $oDataProvider = new DataProvider($aDataSource);
     $oData = $oDataProvider->execute();
     //echo '<pre>', print_r($oData, true), '</pre>'; die();
     $aResult = array();
     $aResult[] = array('Name' => $this->getDefaultText(), 'Value' => $this->getDefaultValue());
     if ($this->getDefault()) {
         $aRs = array();
         if (preg_match("#:(.*?)#isU", $this->getDefault(), $aRs)) {
             $value = Toolkit::getInstance()->request->get($aRs[1], Request::C_GET);
         }
     }
     if ($this->getValue()) {
         $value_id = $this->getValue();
     }
     if ($oData->count() > 0) {
         $aResult = $this->getChilds($oData, 1, $aResult);
     }
     echo FormHelper::selectbox($this->getAlias(), $value_id, $aResult, array('class' => 'selectbox', 'id' => 'field_' . $this->getAlias()));
 }
开发者ID:ruxon,项目名称:module-ruxon,代码行数:25,代码来源:RuxonFormViewListTreeColumn.class.php

示例2: render

 public function render()
 {
     $value = 0;
     $value_id = 0;
     $oDataProvider = new DataProvider($this->getDataSource());
     $oData = $oDataProvider->execute();
     //echo '<pre>', print_r($oData, true), '</pre>'; die();
     $aResult = array();
     /*$aResult[] = array(
           'Name' => $this->getDefaultText(),
           'Value' => $this->getDefaultValue()
       ); */
     if ($this->getDefault()) {
         $aRs = array();
         if (preg_match("#:(.*?)#isU", $this->getDefault(), $aRs)) {
             $value = Toolkit::getInstance()->request->get($aRs[1], Request::C_GET);
         }
     }
     //echo 'val:', print_r($this->getValue()->toSimpleArray(), true);
     if ($this->getValue()) {
         $value_id = $this->getValue()->toSimpleArray();
     }
     if ($oData->count() > 0) {
         foreach ($oData as $itm) {
             $getter = 'get' . $this->getValueField();
             $aResultTmp = array('Value' => call_user_func(array($itm, $getter)), 'Name' => $this->getTextFormat());
             $aRs = array();
             if (preg_match_all("/:(.*):/iU", $aResultTmp['Name'], $aRs)) {
                 foreach ($aRs[1] as $k => $val) {
                     $value = $itm;
                     if (strpos($val, "-") !== false) {
                         $xVal = explode("-", $val);
                         foreach ($xVal as $_val) {
                             $sGetter = 'get' . $_val;
                             $value = call_user_func(array($value, $sGetter));
                         }
                     } else {
                         $sGetter = 'get' . $val;
                         $value = call_user_func(array($value, $sGetter));
                     }
                     $aResultTmp['Name'] = str_replace($aRs[0][$k], $value, $aResultTmp['Name']);
                 }
             }
             /*if (isset($aContainer['IsTree']) && $aContainer['IsTree'] == true) {
             			$aResultTmp['Name'] = str_repeat(' |-- ', $itm->getTreeLevel() - 1).$aResultTmp['Name'];
             		}*/
             $aResult[] = $aResultTmp;
         }
     }
     $sResult = FormHelper::multiselect($this->getAlias() . '[]', $value_id, $aResult, array('class' => 'multiselect', 'id' => 'field_' . $this->getAlias()));
     if ($this->getExtended()) {
         $sResult .= '<script>$(document).ready(
             function()
             {
                 $(\'#field_' . $this->getAlias() . '\').multiselect({sortable: false, searchable: false});
             }
         );</script>';
     }
     echo $sResult;
 }
开发者ID:ruxon,项目名称:module-ruxon,代码行数:60,代码来源:RuxonFormViewMultiselectColumn.class.php

示例3: render

 public function render()
 {
     $value = 0;
     $value_id = 0;
     $aDataSource = $this->getDataSource();
     if ($this->getIsTree()) {
         $aDataSource[2]['Criteria']['ParentId'] = 0;
     }
     $oDataProvider = new DataProvider($aDataSource);
     $oData = $oDataProvider->execute();
     //echo '<pre>', print_r($oData, true), '</pre>'; die();
     $aResult = array();
     $aResult[] = array('Name' => $this->getDefaultText(), 'Value' => $this->getDefaultValue());
     if ($this->getDefault()) {
         $aRs = array();
         if (preg_match("#:(.*?)#isU", $this->getDefault(), $aRs)) {
             $value = Toolkit::getInstance()->request->get($aRs[1], Request::C_GET);
         }
     }
     if ($this->getValue()) {
         $value_id = $this->getValue();
     }
     $aResult = $this->createRow($oData, $aResult);
     if ($this->getOnChange()) {
         $tmpChange = $this->getOnChange();
         echo FormHelper::selectbox($this->getAlias(), $value_id, $aResult, array('class' => 'selectbox ajax_response_list', 'data-field' => $tmpChange[0], 'data-id' => $this->getValue(), 'id' => 'field_' . $this->getAlias()));
         //$.post('/structure/page_backend/typeParams', {Id: $this->getValue()}, function (data) { /* response */ });
     } else {
         echo FormHelper::selectbox($this->getAlias(), $value_id, $aResult, array('class' => 'selectbox', 'id' => 'field_' . $this->getAlias()));
     }
 }
开发者ID:ruxon,项目名称:module-ruxon,代码行数:31,代码来源:RuxonFormViewListColumn.class.php

示例4: execute

 function execute($par)
 {
     global $wgOut;
     $this->setHeaders();
     $topFiveArray = DataProvider::GetTopFiveArray();
     if (empty($par)) {
         //no sub gets generic title
         $wgOut->setPageTitle("Top");
         //use array keys of known modules to build menu to them
         $wgOut->addHtml("<ul>");
         foreach ($topFiveArray[0] as $sub => $junk) {
             $wgOut->addHtml("<li><a href=\"" . SpecialPage::getTitleFor('Top', $sub)->getLocalUrl() . "\">" . wfMsg($sub) . "</a></li>");
         }
         $wgOut->addHtml("</ul>");
         return false;
     }
     if (count($topFiveArray) != 2 || !isset($topFiveArray[0][$par])) {
         $wgOut->setPageTitle("Error");
         // par wasnt in known module list, so cant use for title
         return false;
     }
     //we can trust par for use in title now
     $wgOut->setPageTitle(wfMsg($par));
     $wgOut->addHtml("<ul>");
     $results = DataProvider::$topFiveArray[0][$par](25);
     if (is_array($results)) {
         foreach ($results as $val) {
             $wgOut->addHtml("<li><a href=\"{$val['url']}\">{$val['text']}</a></li>");
         }
     }
     $wgOut->addHtml("</ul>");
 }
开发者ID:Tjorriemorrie,项目名称:app,代码行数:32,代码来源:Top_body.php

示例5: action_reply

 /**
  * Handle incoming SMS from Twilio
  */
 public function action_reply()
 {
     //Check if data provider is available
     $providers_available = Kohana::$config->load('features.data-providers');
     if (!$providers_available['twilio']) {
         throw HTTP_Exception::factory(403, 'The Twilio data source is not currently available. It can be accessed by upgrading to a higher Ushahidi tier.');
     }
     if ($this->request->method() != 'POST') {
         // Only POST is allowed
         throw HTTP_Exception::factory(405, 'The :method method is not supported. Supported methods are :allowed_methods', array(':method' => $this->request->method(), ':allowed_methods' => Http_Request::POST))->allowed(Http_Request::POST);
     }
     $provider = DataProvider::factory('twilio');
     // Authenticate the request
     $options = $provider->options();
     if ($this->request->post('AccountSid') !== $options['account_sid']) {
         throw HTTP_Exception::factory(403, 'Incorrect or missing AccountSid');
     }
     // Remove Non-Numeric characters because that's what the DB has
     $to = preg_replace("/[^0-9,.]/", "", $this->request->post('To'));
     $from = preg_replace("/[^0-9,.]/", "", $this->request->post('From'));
     $message_text = $this->request->post('Body');
     $message_sid = $this->request->post('MessageSid');
     // @todo use other info from twillio, ie: location, media
     $provider->receive(Message_Type::SMS, $from, $message_text, $to, NULL, $message_sid);
     // If we have an auto response configured, return the response messages
     if (!empty($options['sms_auto_response'])) {
         $body = View::factory('twillio/sms_response')->set('response', $options['sms_auto_response'])->render();
         // Set the correct content-type header
         $this->response->headers('Content-Type', 'text/xml');
         $this->response->body($body);
     }
 }
开发者ID:gjorgiev,项目名称:platform,代码行数:35,代码来源:Twilio.php

示例6: action_index

 public function action_index()
 {
     // Set up custom error view
     Kohana_Exception::$error_view = 'error/data-provider';
     if ($this->request->method() != 'GET') {
         // Only GET is allowed as FrontlineSms does only GET request
         throw HTTP_Exception::factory(405, 'The :method method is not supported. Supported methods are :allowed_methods', array(':method' => $this->request->method(), ':allowed_methods' => Http_Request::GET))->allowed(Http_Request::GET);
     }
     $provider = DataProvider::factory('frontlinesms');
     // Authenticate the request
     $options = $provider->options();
     if (!isset($options['key']) or empty($options['key'])) {
         throw HTTP_Exception::factory(403, 'Key value has not been configured');
     }
     if (!$this->request->query('key') or $this->request->query('key') != $options['key']) {
         throw HTTP_Exception::factory(403, 'Incorrect or missing key');
     }
     if (!$this->request->query('m')) {
         throw HTTP_Exception::factory(403, 'Missing message');
     }
     // Remove Non-Numeric characters because that's what the DB has
     $from = preg_replace('/\\D+/', "", $this->request->post('from'));
     $message_text = $this->request->query('m');
     // If receiving an SMS Message
     if ($from and $message_text) {
         $provider->receive(Message_Type::SMS, $from, $message_text, $to);
     }
     $json = array('payload' => array('success' => TRUE, 'error' => NULL));
     // Set the correct content-type header
     $this->response->headers('Content-Type', 'application/json');
     $this->response->body(json_encode($json));
 }
开发者ID:nolanglee,项目名称:platform,代码行数:32,代码来源:Frontlinesms.php

示例7: action_index

 public function action_index()
 {
     // Set up custom error view
     Kohana_Exception::$error_view = 'error/data-provider';
     //Check if data provider is available
     $providers_available = Kohana::$config->load('features.data-providers');
     if (!$providers_available['smssync']) {
         throw HTTP_Exception::factory(403, 'The SMS Sync data source is not currently available. It can be accessed by upgrading to a higher Ushahidi tier.');
     }
     $methods_with_http_request = [Http_Request::POST, Http_Request::GET];
     if (!in_array($this->request->method(), $methods_with_http_request)) {
         // Only POST or GET is allowed
         throw HTTP_Exception::factory(405, 'The :method method is not supported. Supported methods are :allowed_methods', array(':method' => $this->request->method(), ':allowed_methods' => implode(',', $methods_with_http_request)))->allowed($methods_with_http_request);
     }
     $this->_provider = DataProvider::factory('smssync');
     $this->options = $this->_provider->options();
     // Ensure we're always returning a payload..
     // This will be overwritten later if incoming or task methods are run
     $this->_json['payload'] = ['success' => TRUE, 'error' => NULL];
     // Process incoming messages from SMSSync only if the request is POST
     if ($this->request->method() == 'POST') {
         $this->_incoming();
     }
     // Attempt Task if request is GET and task type is 'send'
     if ($this->request->method() == 'GET' and $this->request->query('task') == 'send') {
         $this->_task();
     }
     // Set the response
     $this->_set_response();
 }
开发者ID:tobiasziegler,项目名称:platform,代码行数:30,代码来源:Smssync.php

示例8: action_gather

 /**
  * Callback for 'gather' response on call to Twilio
  */
 public function action_gather()
 {
     if ($this->request->method() != 'POST') {
         // Only POST is allowed
         throw HTTP_Exception::factory(405, 'The :method method is not supported. Supported methods are :allowed_methods', array(':method' => $this->request->method(), ':allowed_methods' => Http_Request::POST))->allowed(Http_Request::POST);
     }
     $provider = DataProvider::factory('twilio');
     // Authenticate the request
     $options = $provider->options();
     if ($this->request->post('AccountSid') !== $options['account_sid']) {
         // Could not authenticate the request?
         throw HTTP_Exception::factory(403, 'Incorrect or missing AccountSid');
     }
     // Remove Non-Numeric characters because that's what the DB has
     $to = preg_replace("/[^0-9,.]/", "", $this->request->post('To'));
     $from = preg_replace("/[^0-9,.]/", "", $this->request->post('From'));
     $message_sid = $this->request->post('CallSid');
     $digits = $this->request->post('Digits');
     if ($digits == 1) {
         $message_text = 'IVR: Okay';
     } else {
         if ($digits == 2) {
             $message_text = 'IVR: Not Okay';
         } else {
             // HALT
             Kohana::$log->add(Log::ERROR, __("':digits' is not a valid IVR response", array(":digits" => $digits)));
             return;
         }
     }
     $provider->receive(Message_Type::IVR, $from, $message_text, $to, NULL, $message_sid);
 }
开发者ID:puffadder,项目名称:platform,代码行数:34,代码来源:Twilio.php

示例9: CheckLoginInDB

 function CheckLoginInDB($username, $password)
 {
     if (empty($username) || empty($password)) {
         $this->HandleError("Tên đăng nhập / Mật khẩu không được để trống");
         return -1;
     } else {
         //$password = md5($password);
         //$connection = mysqli_connect("localhost","root","","tapdoc");
         //$query  = mysqli_query($connection, "SELECT * FROM taikhoan WHERE tk_TenDangNhap='$username' AND tk_MatKhau = '$password'");
         $sql = "SELECT * FROM taikhoan WHERE tk_TenDangNhap='{$username}' AND tk_MatKhau = '{$password}'";
         $query = DataProvider::ExecuteQuery($sql);
         $rows = mysqli_num_rows($query);
         if ($rows == 1) {
             $id = -1;
             while ($row = $query->fetch_assoc()) {
                 $id = $row["tk_ID"];
             }
             //mysqli_close($connection);
             return $id;
         } else {
             $this->HandleError("Tên đăng nhập / Mật khẩu không hợp lệ");
         }
         //mysqli_close($connection);
     }
 }
开发者ID:hackernam,项目名称:TapDoc-HocSinhLop1,代码行数:25,代码来源:xuly_dangnhap.php

示例10: WidgetTopContentGetSectionsList

function WidgetTopContentGetSectionsList()
{
    wfProfileIn(__METHOD__);
    $provider =& DataProvider::singleton();
    list($links, $active) = $provider->GetTopFiveArray();
    unset($links['community']);
    wfProfileOut(__METHOD__);
    return array(0 => $links, 1 => $active);
}
开发者ID:Tjorriemorrie,项目名称:app,代码行数:9,代码来源:WidgetTopContent.php

示例11: delete

 public static function delete($id)
 {
     $strSQL = "delete from thuchi where id={$id}";
     $result = DataProvider::Query($strSQL);
     if (mysql_affected_rows() == 0) {
         return null;
     }
     return mysql_fetch_row($result, MYSQL_BOTH);
 }
开发者ID:edconan93,项目名称:real-estate-website,代码行数:9,代码来源:ThuChiDAO.php

示例12: GetPhapLyById

 public static function GetPhapLyById($id)
 {
     $strSQL = "select *\r\n\t\t\t\t\tfrom tinhtrangphaply where id='{$id}'";
     $result = DataProvider::Query($strSQL);
     if (mysql_num_rows($result) == 0) {
         return null;
     }
     return mysql_fetch_array($result);
 }
开发者ID:edconan93,项目名称:real-estate-website,代码行数:9,代码来源:PhapLyDAO.php

示例13: getALL

 public static function getALL()
 {
     $strSQL = "select * from loaidichvu";
     $result = DataProvider::Query($strSQL);
     while ($row = mysql_fetch_row($result, MYSQL_BOTH)) {
         $return[] = $row;
     }
     return $return;
 }
开发者ID:edconan93,项目名称:real-estate-website,代码行数:9,代码来源:LoaiDichVuDAO.php

示例14: GetTTNDByID

 public static function GetTTNDByID($id)
 {
     $strSQL = "select * \r\n\t\t\t\t\t   from loaidichvu\r\n\t\t\t\t\t   where id='{$id}'";
     $result = DataProvider::Query($strSQL);
     if (mysql_num_rows($result) == 0) {
         return null;
     }
     return mysql_fetch_array($result);
 }
开发者ID:edconan93,项目名称:real-estate-website,代码行数:9,代码来源:TTNhaDatDAO.php

示例15: GetAllTienIchId

 public static function GetAllTienIchId($id)
 {
     $strSQL = "select *\r\n\t\t\t\t\t   from tienich where id='{$id}'";
     $result = DataProvider::Query($strSQL);
     if (mysql_num_rows($result) == 0) {
         return null;
     }
     return mysql_fetch_array($result);
 }
开发者ID:edconan93,项目名称:real-estate-website,代码行数:9,代码来源:TienIchDAO.php


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