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


PHP JSON_decode函数代码示例

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


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

示例1: getConfig

 /** getConfig
  *  @return object $config
  */
 public function getConfig($temakor_id = 0)
 {
     $res = false;
     $db = JFactory::getDBO();
     if ($temakor_id != 0) {
         $db->setQuery('select * from #__beallitasok where id = (10+' . $temakor_id . ')');
         $res = $db->loadObject();
         if ($res->json == '' | $res->json == '[]') {
             $res = false;
         }
     }
     if ($res == false) {
         $db->setQuery('select * from #__beallitasok where id = 1');
         $res = $db->loadObject();
     }
     if ($res) {
         $result = JSON_decode($res->json);
     } else {
         $result = JSON_decode('{
   "temakor_felvivok":1,
   "tobbszintu_atruhazas":1,
   "atruhazas_lefele_titkos":0
   }');
     }
     return $result;
 }
开发者ID:madcsaba,项目名称:li-de,代码行数:29,代码来源:temakorok.php

示例2: shouldRemoveProgressInfoFromRequest

 /**
  * @test
  */
 public function shouldRemoveProgressInfoFromRequest()
 {
     // given
     $handler = new RequestHandlerMock();
     // when
     $json = $handler->handle("Car/1/read", array('LudoDBProgressID' => $this->getUniqueProgressId()));
     $response = JSON_decode($json, true);
     $data = $response['response'];
     // then
     $this->assertTrue($response['success'], $json);
     $this->assertNotNull($data['brand'], $json);
     $this->assertEquals('Opel', $data['brand'], $json);
 }
开发者ID:manishkhanchandani,项目名称:mkgxy,代码行数:16,代码来源:LudoDBProgressTest.php

示例3: __construct

    /**
     * objektum generálás
     */
    function __construct()
    {
        parent::__construct();
        // ============================== FIGYELEM Ha több szüro mezo van akkor át kell írni! ===================
        $this->state = JSON_decode('{
		"orderCol":"1", 
		"orderDir":"asc",
		"filterStr":"",
		"limitstart":0,
		"limit":10,
		"id":""
		}
		');
        $this->message = JSON_decode('{
		"txt":"",
		"class":"msg"
		}
	    ');
        if (file_exists(JPATH_COMPONENT . '/helpers/keszlet.php')) {
            include_once JPATH_COMPONENT . '/helpers/keszlet.php';
            $this->helper = new keszletHelper();
        }
    }
开发者ID:utopszkij,项目名称:keszlet,代码行数:26,代码来源:varhatok.php

示例4: index

 /**
  * Display a listing of the resource.
  *
  * @return Response
  */
 public function index()
 {
     //
     // For this week's batch of items
     $requiredItems = array();
     if (isset($_GET['all'])) {
         // Want all orders for some reason, use with caution
         $orders = Order::orderBy('id', 'desc')->get();
         foreach ($orders as $order) {
             // Parse it so that the template knows how to use it
             $order->item_array = JSON_decode($order->item_array);
         }
     } else {
         // Get unpaid orders by default
         $orders = Order::where('paid', '=', 0)->orderBy('id', 'desc')->get();
         // Calculate totals for this batch
         foreach ($orders as $order) {
             $order->item_array = JSON_decode($order->item_array);
             foreach ($order->item_array as $item) {
                 if (array_key_exists($item->name, $requiredItems)) {
                     // The item was already added, just add the quantity
                     $requiredItems[$item->name] += $item->qty;
                 } else {
                     // The item isn't added yet, make a new entry
                     $requiredItems[$item->name] = $item->qty;
                 }
             }
         }
     }
     return Response::json(array('orders' => $orders, 'requiredItems' => $requiredItems));
     /*
             return view('orders.index')->with(array(
                 'orders' => $orders,
                 'requiredItems' => $requiredItems
             ));*/
 }
开发者ID:BrynnLawson,项目名称:smarka,代码行数:41,代码来源:OrdersController.php

示例5: query_as_array

    $ext[$tmp['se']] = $tmp;
}
// Languages
$langs = query_as_array("SELECT * FROM cardname WHERE card_id = {$id}");
?>
  <a href="http://magiccards.info/query?q=!<?php 
echo $card_bdd['name'];
?>
&v=card&s=cname">View on MCI</a>
  <table>
   <tr>
    <th>Extensions</th>
    <td>
     <ul>
<?php 
$json = JSON_decode($card_bdd['attrs']);
foreach ($ext as $i => $value) {
    if ($ext[$i]['nbpics'] == 0) {
        echo '      <li>' . $ext[$i]['name'] . ' (' . $ext[$i]['rarity'] . ')</li>';
    } else {
        if ($ext[$i]['nbpics'] == 1) {
            $imgurl = $cardimages_default . '/' . $ext[$i]['se'] . '/' . addslashes(card_img_by_name($card_bdd['name']));
            if (isset($json->transformed_attrs->name)) {
                $imgurl .= "', '" . $cardimages_default . '/' . $ext[$i]['se'] . '/' . addslashes(card_img_by_name($json->transformed_attrs->name));
            }
            echo '      <li><a href="extension.php?ext=' . $ext[$i]['se'] . '" onmouseover="javascript:setimage(\'' . $imgurl . '\')">' . $ext[$i]['name'] . '</a> (' . $ext[$i]['rarity'] . ')' . "\n";
            echo '      </li>';
            if (!isset($firstimgurl)) {
                $firstimgurl = $imgurl;
            }
        } else {
开发者ID:OlivierLamiraux,项目名称:mtgas,代码行数:31,代码来源:card.php

示例6: save

 /**
  * szellemi termelés változat   adat térolás adatbázisba
  * @param object
  * @JRequest imgdel0,imgdel1,imgdel2,imgdel3
  * @JRequest img0, img1, img2, img3
  * @return boolean
  */
 public function save($item)
 {
     $user = JFactory::getUser();
     // eredeti rekord elérése
     $orig = $this->get_product_view_product_row($item->id);
     // eredeti images elérése
     if ($orig->images != '') {
         $origImages = JSON_decode($orig->images);
     } else {
         $origImages = array();
     }
     while (count($origImages) < 4) {
         $origImages[] = '';
     }
     // images_delete kérések teljesitése
     for ($i = 0; $i < 5; $i++) {
         $fn = 'imgdel' . $i;
         if (JRequest::getVar($fn) == 1) {
             unlink($origImages[$i]);
             $origImages[$i] = '';
         }
     }
     // alapértelmezett értékek beirása
     $item->published = 1;
     if ($item->model == '') {
         $item->model = $user->username;
     }
     $item->alias = strtolower(preg_replace("/[^A-Za-z0-9]/", '', $item->name));
     $item->date_added = date('Y-m-d H:i:s');
     $item->category_id = JRequest::getVar('category_id', $orig->category_id);
     if ($item->category_id == '') {
         $item->category_id = $orig->category_id;
     }
     // tárolás adatbázisba
     $table = JTable::getInstance('products', 'EcommercewdTable');
     foreach ($item as $fn => $fv) {
         $table->{$fn} = $fv;
     }
     $result = $table->store();
     // új product_id lekérdezése
     $product_id = $table->id;
     $this->product_id = $product_id;
     // image uploadok végrehajtása, új images kialakitása
     if ($result) {
         for ($i = 0; $i < 5; $i++) {
             if (file_exists($_FILES['img' . $i]['tmp_name']) & is_uploaded_file($_FILES['img' . $i]['tmp_name'])) {
                 $targetFile = 'media/com_ecommercewd/uploads/images/products/' . substr($product_id, 0, 2);
                 if (!is_dir($targetFile)) {
                     mkdir($targetFile, 0777);
                 }
                 $fileExt = strtolower(pathinfo($_FILES['img' . $i]['name'], PATHINFO_EXTENSION));
                 if ($fileExt == 'jpg' | $fileExt == 'png') {
                     $targetFile .= '/' . $product_id . '_' . $_FILES['img' . $i]['name'];
                     if (file_exists($targetFile)) {
                         unlink($targetFile);
                     }
                     if (move_uploaded_file($_FILES['img' . $i]["tmp_name"], $targetFile)) {
                         $origImages[$i] = $targetFile;
                     } else {
                         $this->setError(JTEXT::_('COM_ECOMMERCEWD_SAVE_ERROR_1'));
                         $result = false;
                     }
                 } else {
                     $this->setError(JTEXT::_('COM_ECOMMERCEWD_ILLEGAL_FILE_EXTENSION') . ' fileExt=' . $fileExt);
                     $result = false;
                 }
             }
         }
         // rekord update, új images adat kitárolása az adatbázisba
         $images = array();
         foreach ($origImages as $image) {
             if ($image != '') {
                 $images[] = $image;
             }
         }
         $table->images = JSON_encode($images);
         if ($table->store() == false) {
             $this->setError(JTEXT::_('COM_ECOMMERCEWD_SAVE_ERROR_2'));
             $result = false;
         }
     } else {
         $this->setError(JTEXT::_('COM_ECOMMERCEWD_SAVE_ERROR_0'));
     }
     return $result;
 }
开发者ID:madcsaba,项目名称:li-de,代码行数:92,代码来源:products.php

示例7: cancel

 /**
  * do cancelClick: redirect to lister
  * JRequest: --     
  */
 public function cancel()
 {
     // pop lister status from listStatusStack
     $session = JFactory::getSession();
     $listStatusStack = JSON_decode($session->get('listStatusStack', '[]'));
     $listStatus = $listStatusStack[count($listStatusStack) - 1];
     unset($listStatusStack[count($listStatusStack) - 1]);
     $link = JURI::base() . 'index.php?option=com_ammvc' . '&task=' . $this->viewName . '.list' . '&limitstart=' . $listStatus->limitstart . '&limit=' . $listStatus->limit . '&ordering=' . $listStatus->ordering . '&parent=' . $listStatus->parent . '&filterStr=' . $listStatus->filterStr;
     $this->setRedirect($link);
 }
开发者ID:madcsaba,项目名称:li-de,代码行数:14,代码来源:users.php

示例8: browse

 /**
  * browse task
  * @return void
  * @request integer limit
  * @request integer limitstart
  * @request integer order
  * @request integer filterStr
  * @session object 'temakoroklist_status'   
  */
 public function browse()
 {
     jimport('hs.user.user');
     JHTML::_('behavior.modal');
     $temakor_id = JRequest::getVar('temakor', 0);
     $config = $this->temakorokHelper->getConfig($temakor_id);
     $kepviseletAtruhazasMegngedett = $config->tobbszintu_atruhazas == 1;
     $total = 0;
     $pagination = null;
     $user = JFactory::getUser();
     $db = JFactory::getDBO();
     // alapértelmezett browser status beolvasása sessionból
     $session = JFactory::getSession();
     $brStatusStr = $session->get($this->NAME . 'list_status');
     if ($brStatusStr == '') {
         $brStatusStr = '{"limit":20,"limitStart":0,"order":1,"filterStr":""}';
     }
     $brStatus = JSON_decode($brStatusStr);
     $limitStart = JRequest::getVar('limitstart', $brStatus->limitstart);
     $limit = JRequest::getVar('limit', $brStatus->limit);
     $order = JRequest::getVar('order', $brStatus->order);
     $filterStr = urldecode(JRequest::getVar('filterStr', $brStatus->filterStr));
     // browser status save to session and JRequest
     $brStatus->limit = $limit;
     $brStatus->limitStart = $limitStart;
     $brStatus->order = $order;
     $brStatus->filterStr = $filterStr;
     $session->set($this->NAME . 'list_status', JSON_encode($brStatus));
     JRequest::setVar('limit', $limit);
     JRequest::setVar('limitstart', $limitStart);
     JRequest::setVar('order', $order);
     JRequest::setVar('filterStr', $filterStr);
     // adattábla tartalom elérése és átadása a view -nek
     $items = $this->model->getItems();
     $this->view->set('Items', $items);
     // browser müködéshez linkek definiálása
     $reorderLink = JURI::base() . 'index.php?option=com_' . $this->NAME . '&view=' . $this->NAME . 'list' . '&limit=' . JRequest::getVar('limit', '20') . '&limitstart=0' . '&filterStr=' . urlencode($filterStr);
     $doFilterLink = JURI::base() . 'index.php?option=com_' . $this->NAME . '&view=' . $this->NAME . 'list' . '&limit=' . JRequest::getVar('limit', '20') . '&limitstart=0' . '&order=' . JRequest::getVar('order', '1');
     $itemLink = JURI::base() . 'index.php?option=com_szavazasok&view=szavazasoklist' . '&limit=' . JRequest::getVar('limit', '20') . '&limitstart=0' . '&filterStr=' . urlencode($filterStr) . '&order=' . JRequest::getVar('order', '1');
     $this->view->set('reorderLink', $reorderLink);
     $this->view->set('doFilterLink', $doFilterLink);
     $this->view->set('itemLink', $itemLink);
     // van ált. képviselője?
     $kepviseloje = 0;
     $db->setQuery('select k.kepviselo_id, u.name 
 from #__kepviselok k, #__users u
 where k.kepviselo_id = u.id and
         k.user_id = "' . $user->id . '" and k.temakor_id=0 and k.szavazas_id = 0 and
         k.lejarat >= "' . date('Y-m-d') . '"');
     $res = $db->loadObject();
     if ($db->getErrorNum() > 0) {
         $db->stderr();
     }
     if ($res) {
         $kepviseloje = $res->kepviselo_id;
     }
     // Ő maga képviselő jelölt?
     $kepviseloJelolt = false;
     $db->setQuery('select user_id 
 from #__kepviselojeloltek
 where  user_id = "' . $user->id . '" and temakor_id=0');
     $res = $db->loadObject();
     if ($db->getErrorNum() > 0) {
         $db->stderr();
     }
     if ($res) {
         $kepviseloJelolt = true;
     }
     // kik a témakor felvivők?
     $temakor_felvivo = $this->temakor_felvivo();
     // akciók definiálása
     $akciok = array();
     if ($this->temakorokHelper->isAdmin($user) | $temakor_felvivo == 1 & $user->id > 0) {
         $akciok['ujTemakor'] = JURI::base() . 'index.php?option=com_' . $this->NAME . '&view=' . $this->NAME . '&task=add';
     }
     if ($this->temakorokHelper->isAdmin($user)) {
         $akciok['beallitasok'] = JURI::base() . 'index.php?option=com_beallitasok';
     }
     $akciok['tagok'] = JURI::base() . 'index.php?option=com_tagok';
     $akciok['sugo'] = JURI::base() . 'index.php?option=com_content&view=article' . '&id=' . JText::_(strtoupper($this->NAME) . 'LIST_SUGO') . '&Itemid=435&tmpl=component';
     $this->view->set('Akciok', $akciok);
     // globális képviselő/képviselő jelölt gombok definiálása
     $kepviselo = array();
     $kepviselo['kepviselojeLink'] = '';
     $kepviselo['kepviseloJeloltLink'] = '';
     $kepviselo['kepviselotValasztLink'] = '';
     $kepviselo['ujJeloltLink'] = '';
     if ($user->id > 0) {
         if ($kepviseloje > 0) {
             $kepviseloUser = JFactory::getUser($kepviseloje);
             if ($kepviseloUser) {
//.........这里部分代码省略.........
开发者ID:madcsaba,项目名称:li-de,代码行数:101,代码来源:controller.php

示例9: session_start

<?php

session_start();
$contents = file_get_contents('php://input');
$data = JSON_decode($contents);
//var_dump($data);
if (!empty($data)) {
    $sid = $data->SID;
    $firstname = $data->firstname;
    $surname = $data->surname;
    $sex = $data->sex;
    $year = $data->year;
    $username = $data->username;
    $password = $data->password;
    $class = $data->class;
}
$sql = "UPDATE MyStudents SET `firstname` = '{$firstname}', `lastname` = '{$surname}', `sex` = '{$sex}', `year` = '{$year}', `username` = '{$username}', `password` = '{$password}', `class` = '{$class}' WHERE `Sid` = '{$sid}'";
$conn = new mysqli("localhost", "root", "duckvin", "myDb");
if ($conn->connect_errno > 0) {
    die("Connection failed: " . mysqli_connect_error());
}
if ($conn->query($sql) === TRUE) {
    echo "Student updated";
} else {
    echo "Error: " . $sql . "<br>" . $conn->error;
}
$conn->close();
开发者ID:ndew4739,项目名称:curly-waffle,代码行数:27,代码来源:update-student.php

示例10: getState

 /**
  * $this->state feltöltése a session és JRequest  alapjánn
  * Ha JRequest érkezik az irja felül a session -t
  */
 protected function getState()
 {
     $session = JFactory::getSession();
     $storedState = JSON_decode($session->get($this->browserName . 'State'));
     if (is_object($storedState)) {
         $this->state = $storedState;
     }
     foreach ($this->state as $fn => $fv) {
         $this->state->{$fn} = JRequest::getVar($fn, $fv);
     }
 }
开发者ID:utopszkij,项目名称:lmp,代码行数:15,代码来源:components.php

示例11: or

                                    $db->setQuery('select sz.* 
	from #__szavazasok sz
	left outer join #__temakorok t on t.id = sz.temakor_id
	left outer join #__tagok ta on ta.temakor_id = sz.temakor_id
	where sz.id=' . $db->quote($data->poll_id) . ' and
	((ta.user_id = ' . $db->quote($user->id) . ') or (t.lathatosag = 0)) 
	limit 1');
                                    $szavazas = $db->loadObject();
                                    JRequest::setVar('szavazas', $szavazas->id);
                                    JRequest::setVar('temakor', $szavazas->temakor_id);
                                    if ($szavazas) {
                                        // ha van cachelt eredmény beolvasom azt  és azt használom
                                        $db->setQuery('select * from #__poll_value_cache where pollid="' . $szavazas->id . '" and vote_count = -1');
                                        $res = $db->loadObject();
                                        if ($res) {
                                            $result1 = JSON_decode($res->report);
                                            $result = $result->result;
                                            $result->voters = $result1->voters;
                                            $result->api_status = $result1->api_status;
                                        } else {
                                            // ha nincs most képzem az eredményt
                                            $c = new Condorcet($db, $szavazas->temmakor_id, $szavazas->id);
                                            $result = $c->report('json');
                                            $db->setQuery('select count(*) cc from #__szavazok where szavazas_id = ' . $db->quote($szavazas->id));
                                            $res = $db->loadObject();
                                            $result->voters = $res->cc;
                                            $result->api_status = "OK";
                                            // ha lezárt szavazás akkor tárolom a cache -be
                                            if ($szavazas->lezart == 1) {
                                                $db->setQuery('INSERT INTO #__poll_value_cache 
	        VALUES (' . $szavazas->temakor_id . ', 
开发者ID:madcsaba,项目名称:li-de,代码行数:31,代码来源:lideapi.php

示例12: getADAuserData

 /**
  * userData objektum lekérése az ADA szervertől
  * @param object token  {"access_token":"xxxxxxxx",......}
  * @return object  {"userid":"xxxxxxxx", "email":"xxxxxxxx",......}
  */
 protected function getADAuserData($token)
 {
     $userData = new stdClass();
     $url = $this->ADA_USER_URI;
     $data = array('timeout' => 30, 'redirection' => 10, 'httpversion' => '1.0', 'blocking' => true, 'cookies' => array(), 'sslverify' => $this->sslverify);
     $extraHeader = 'Authorization: Bearer ' . $token->access_token;
     $result = $this->remoteCall($url, 'GET', $data, $extraHeader);
     if ($result != '') {
         $userData = JSON_decode($result);
     }
     return $userData;
 }
开发者ID:edemo,项目名称:Joomla_oauth_plugin,代码行数:17,代码来源:index.php

示例13: browse

 /**
  * browse task
  * @return void
  * @request integer limit
  * @request integer limitstart
  * @request integer order
  * @request integer filterStr
  * @request integer temakor
  * @request integer szavazas      
  * @session object 'temakoroklist_status'   
  */
 public function browse()
 {
     jimport('hs.user.user');
     JHTML::_('behavior.modal');
     $total = 0;
     $pagination = null;
     $user = JFactory::getUser();
     $db = JFactory::getDBO();
     // alapértelmezett browser status beolvasása sessionból
     $session = JFactory::getSession();
     $brStatusStr = $session->get($this->NAME . 'list_status');
     if ($brStatusStr == '') {
         $brStatusStr = '{"limit":20,"limitstart":0,"order":1,"filterStr":"","temakor_id":0,"szavazas_id":0}';
     }
     $brStatus = JSON_decode($brStatus);
     $limitStart = JRequest::getVar('limitstart', $brStatus->limitstart);
     $limit = JRequest::getVar('limit', $brStatus->limit);
     $order = JRequest::getVar('order', $brStatus->order);
     $filterStr = urldecode(JRequest::getVar('filterStr', $brStatus->filterStr));
     if ($this->temakor_id == '') {
         $this->temakor_id = $brStatus->temakor_id;
     }
     if ($this->szavazas_id == '') {
         $this->szavazas_id = $brStatus->szavazas_id;
     }
     // browser status save to session and JRequest
     $brStatus->limit = $limit;
     $brStatus->limitStart = $limitStart;
     $brStatus->order = $order;
     $brStatus->filterStr = $filterStr;
     $brStatus->temakor_id = $this->temakor_id;
     $brStatus->szavazas_id = $this->szavazas_id;
     $session->set($this->NAME . 'list_status', JSON_encode($brStatus));
     JRequest::setVar('limit', $limit);
     JRequest::setVar('limitstart', $limitstart);
     JRequest::setVar('order', $order);
     JRequest::setVar('filterStr', $filterStr);
     JRequest::setVar('temakor', $this->temakor_id);
     JRequest::setVar('szavazas', $this->szavazas_id);
     // adattábla tartalom elérése és átadása a view -nek
     $items = $this->model->getItems();
     //DBG echo $this->model->getDBO()->getQuery();
     if ($this->model->getError() != '') {
         $this->view->Msg = $this->model->getError();
     }
     $this->view->set('Items', $items);
     $this->view->set('Temakor', $this->temakor);
     $this->view->set('Szavazas', $this->szavazas);
     $this->view->set('Title', JText::_('ALTERNATIVAK'));
     // browser müködéshez linkek definiálása
     if ($this->szavazas->vita1 == 1) {
         $itemLink = JURI::base() . 'index.php?option=com_alternativak&view=alternativak' . '&task=edit' . '&limit=' . JRequest::getVar('limit', '20') . '&limitstart=0' . '&filterStr=' . urlencode($filterStr) . '&order=' . JRequest::getVar('order', '1') . '&temakor=' . $this->temakor_id . '&szavazas=' . $this->szavazas_id;
     } else {
         $itemLink = '';
     }
     $backLink = JURI::base() . 'index.php?option=com_szavazasok&view=szavazasoklist' . '&temakor=' . $this->temakor_id . '&task=browse';
     $homeLink = JURI::base() . 'index.php?option=com_temakorok&view=temakoroklist' . '&task=browse';
     $this->view->set('itemLink', $itemLink);
     $this->view->set('backLink', $backLink);
     $this->view->set('homeLink', $homeLink);
     // van ált. képviselője?
     $altKepviseloje = 0;
     $db->setQuery('select k.kepviselo_id, u.name 
 from #__kepviselok k, #__users u
 where k.kepviselo_id = u.id and
         k.user_id = "' . $user->id . '" and k.temakor_id=0 and k.szavazas_id = 0 and
         k.lejarat >= "' . date('Y-m-d') . '"');
     $res = $db->loadObject();
     if ($db->getErrorNum() > 0) {
         $db->stderr();
     }
     if ($res) {
         $altKepviseloje = $res->kepviselo_id;
     }
     // van témakör képviselője?
     $kepviseloje = 0;
     $db->setQuery('select k.kepviselo_id, u.name 
 from #__kepviselok k, #__users u
 where k.kepviselo_id = u.id and
         k.user_id = "' . $user->id . '" and k.temakor_id=' . $this->temakor_id . ' and k.szavazas_id = 0 and
         k.lejarat >= "' . date('Y-m-d') . '"');
     $res = $db->loadObject();
     if ($db->getErrorNum() > 0) {
         $db->stderr();
     }
     if ($res) {
         $kepviseloje = $res->kepviselo_id;
     }
     // Ő maga képviselő jelölt?
//.........这里部分代码省略.........
开发者ID:madcsaba,项目名称:li-de,代码行数:101,代码来源:controller.php

示例14: available_boards

 public function available_boards(&$db)
 {
     try {
         $sql = 'SELECT boardid, title, client, creationDate, dueDate, is_locked, locked_by, lock_expires 
                 FROM storyboards
                 WHERE boardid 
                 IN (SELECT boardid FROM permissions WHERE userid = :userid) 
                 ORDER BY creationDate DESC';
         $stmt = $db->prepare($sql);
         $stmt->bindValue(':userid', $this->userid);
         $stmt->execute();
         $stmt->bindColumn('boardid', $boardid);
         $stmt->bindColumn('title', $title);
         $stmt->bindColumn('client', $client);
         $stmt->bindColumn('creationDate', $creationDate);
         $stmt->bindColumn('dueDate', $dueDate);
         $stmt->bindColumn('is_locked', $is_locked);
         $stmt->bindColumn('locked_by', $locked_by);
         $stmt->bindColumn('lock_expires', $lock_expires);
         $errorInfo = $stmt->errorInfo();
         if (isset($errorInfo[2])) {
             $error = $errorInfo[2];
         }
     } catch (Exception $e) {
         $error = $e->getMessage();
     }
     $stmt->fetch(PDO::FETCH_BOUND);
     if ($boardid) {
         echo '<div class="board-selection">';
         echo '<h2>Select a Storyboard:</h2>';
         echo '<form method="post" action="/storyboardapp/"><fieldset>';
         $i = 0;
         do {
             echo "<label for=\"board-{$i}\"><input type=\"radio\" name=\"boardid\" id=\"board-{$i}\" value=\"{$boardid}\"> <p>" . JSON_decode($title) . ' by ' . JSON_decode($client) . " (created {$creationDate}";
             if ($dueDate != "") {
                 echo '; due ' . $dueDate;
             }
             echo ')';
             if ($is_locked && $locked_by != $this->userid && time() < $lock_expires) {
                 echo ' <span class="submessage">&ast; read-only</span>';
             }
             echo '</p></label>';
             $i++;
         } while ($stmt->fetch(PDO::FETCH_BOUND));
         echo '<label for="board-new"><input type="radio" name="boardid" id="board-new" value="new"> <p>New Storyboard</p></label>';
         echo '</fieldset>';
         echo '<input type="submit" value="Load Board" class="load-board-button">';
         echo '</form>';
         echo '<h4><span class="green">&ast; Boards may be read-only because they are currently being edited by someone else or because you do not have permission to edit them.</span></h4>';
         echo '</div>';
         return true;
     } else {
         return false;
     }
 }
开发者ID:ReveWeber,项目名称:storyboardapp,代码行数:55,代码来源:User.class.php

示例15: ujTag

 /**
  * ujTag felvételi form
  * @return void
  * &JRequest: limit, limitstart, filterStr, order
  */
 public function ujTag()
 {
     JHTML::_('behavior.modal');
     $total = 0;
     $pagination = null;
     $user = JFactory::getUser();
     $db = JFactory::getDBO();
     if (!$this->temakorokHelper->isAdmin($user) & !$this->temakor_admin) {
         echo '<div class="">Access denied</div>';
         return;
     }
     // alapértelmezett browser status beolvasása sessionból
     $session = JFactory::getSession();
     $brStatusStr = '{"limit":20,"limitstart":0,"order":1,"filterStr":""}';
     $brStatus = JSON_decode($brStatusStr);
     $limitStart = JRequest::getVar('limitstart', $brStatus->limitstart);
     $limit = JRequest::getVar('limit', $brStatus->limit);
     $order = JRequest::getVar('order', $brStatus->order);
     $filterStr = urldecode(JRequest::getVar('filterStr', $brStatus->filterStr));
     JRequest::setVar('limit', $limit);
     JRequest::setVar('limitstart', $limitStart);
     JRequest::setVar('order', $order);
     JRequest::setVar('filterStr', $filterStr);
     // adattábla tartalom elérése és átadása a view -nek
     $items = $this->model->getItems();
     //DBG echo $this->model->getDBO()->getQuery();
     $this->view->set('Items', $items);
     // browser müködéshez linkek definiálása
     $reorderLink = JURI::base() . 'index.php?option=com_' . $this->NAME . '&view=' . $this->NAME . 'list&tas=ujTag' . '&limit=' . JRequest::getVar('limit', '20') . '&limitstart=0' . '&temakor=' . $this->temakor_id . '&filterStr=' . urlencode($filterStr);
     $doFilterLink = JURI::base() . 'index.php?option=com_' . $this->NAME . '&view=' . $this->NAME . 'list&task=ujTag' . '&limit=' . JRequest::getVar('limit', '20') . '&limitstart=0' . '&temakor=' . $this->temakor_id . '&order=' . JRequest::getVar('order', '1');
     if ($this->temakor_id > 0) {
         $itemLink = JURI::base() . 'index.php?option=com_tagok&view=tagok&task=doujtag' . '&limit=' . JRequest::getVar('limit', '20') . '&limitstart=0' . '&filterStr=' . urlencode($filterStr) . '&temakor=' . $this->temakor_id . '&order=' . JRequest::getVar('order', '1');
     }
     $this->view->set('reorderLink', $reorderLink);
     $this->view->set('doFilterLink', $doFilterLink);
     $this->view->set('itemLink', $itemLink);
     // akciók definiálása
     $akciok = array();
     if ($this->temakor_id > 0) {
         $akciok['temakor'] = JURI::base() . 'index.php?option=com_szavazasok&view=szavazasoklist&task=browse' . '&temakor=' . $this->temakor_id;
     } else {
         $akciok['temakorok'] = JURI::base() . 'index.php?option=com_temakorok&view=temakoroklist&task=browse';
     }
     $akciok['sugo'] = JURI::base() . 'index.php?option=com_content&view=article' . '&id=' . JText::_('UJTAG_SUGO') . '&Itemid=435&tmpl=component';
     $this->view->set('Akciok', $akciok);
     $this->view->set('Title', JText::_('UJTAG'));
     $this->view->set('Temakor', $this->temakor);
     //lapozósor definiálása
     jimport('joomla.html.pagination');
     $total = $this->model->getTotal($filterStr);
     $pagination = new JPagination($total, $limitStart, $limit);
     $pagination->setAdditionalUrlParam('order', $order);
     $pagination->setAdditionalUrlParam('filterStr', urlencode($filterStr));
     $pagination->setAdditionalUrlParam('temakor', $this->temakor_id);
     $this->view->set('LapozoSor', $pagination->getListFooter());
     $this->view->setLayout('ujtag');
     $this->view->display();
 }
开发者ID:madcsaba,项目名称:li-de,代码行数:63,代码来源:controller.php


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