Retrieves a list of models based on the current search/filter conditions.
public search ( ) : CActiveDataProvider | ||
Résultat | CActiveDataProvider | the data provider that can return the models based on the search/filter conditions. |
public static function search($values = array()) { $result1 = DB::getInstance()->search("category", $values); if (count($result1) != 0) { $category_data = array("cat_name" => $result1[0]["category_name"], "cat_label" => $result1[0]["category_no"]); $new_category = new Category(); $new_category->set_name($result1[0]["category_name"]); $new_category->set_label($result1[0]["category_no"]); $itemList = DB::getInstance()->search("item_category", array("category_id" => $result1[0]["category_id"])); foreach ($itemList as $item) { $new_category->addItem(Item::search(array("item_id" => $item["item_id"]))); } return $new_category; } else { return null; } }
public function update_item_copy_no($new_num) { if ($this->no == $new_num) { return true; } else { $parent_item_id = $this->item_id; $item_copy_id = $this->id; $parent_item = Item::search(array("item_id" => $parent_item_id)); $copies = $parent_item->get_copies(); foreach ($copies as $itemCopy) { if ($itemCopy->get_no() == $new_num) { return false; } } $sql = "UPDATE `item_copy` SET `item_copy_no` = '{$new_num}' WHERE `item_copy`.`item_copy_id` ={$item_copy_id};"; DB::getInstance()->directUpdate($sql); echo $sql; return true; } }
<?php namespace tatt; require_once 'tatt/webcommon.php'; //This file allows for searching, and dynamically populates a table based on a search query. //XXX: Do we want users to be logged in for searching? //Eric: Eventually, yes $auth->require_login(); $valid_search_term = false; if(!(isset($_GET['search']) && $_GET['search'] != "" ) ) { //TODO only display search box } else { $valid_search_term = true; $items = Item::search($_GET['search']); $items_array = array(); foreach($items as $item) { $items_array[] = $item->to_array(); } $page->assign('items', $items_array); } $page->assign('valid_search_term', $valid_search_term); $page->assign('page_title', 'Search Result'); $page->display('search.tpl');
<?php require 'core/init.php'; $item_id = $_GET["item_id"]; $cat_label = $_GET["cat_label"]; if (isset($item_id)) { $item = Item::search(array("item_id" => $item_id)); } $itemName = $item->get_name(); $copies = $item->get_copies(); $itemDescription = $item->get_description(); $itemTechDetails = $item->get_technical_details(); $itemReference = $item->get_reference(); $itemType = $item->get_type(); //echo $itemType; //print_r($item); $itemPic = $itemName; $ItemNameReplaced = str_replace(" ", "%19", $itemName); $itemPic2 = $ItemNameReplaced; echo "<div style=\"font-family: Georgia, serif;font-size:25px;\"><div style=\"font-size:25px; float:left;\" id=\"ItemName1\">{$itemName}</div>\n\t<div style=\"float:right;\">\n\t\n\t</div>\n\t<br>\n\t\t<ul><li> <div style=\"font-size:20px;\">Description</div><div style=\"font-size:15px;\" id=\"ItemDesc1\">{$itemDescription}</div> </li><br>\n\t\t<li> <div style=\"font-size:20px;\">Technical Details</div><div style=\"font-size:15px;\" id=\"ItemTechDet1\">{$itemTechDetails}</div> </li>\n\t\t<li> <div><img id=\"item_pic\" src=\"img/items/{$itemPic}.png\" height=\"195\" width=\"185\" style=\"border:1px solid #ccc;padding:22px\" /></div> </li>\n\n\t\t<li> <div style=\"font-size:20px;\">Reference</div>"; echo "<div id=\"refLinks\">"; foreach ($itemReference as $link) { echo "<div style=\"font-size:15px;\"><a href=\"{$link}\" target=\"_blank\">{$link}</a></div> "; } echo "</div></li>"; echo "</ul></div>";
<?php require_once 'core/init.php'; $password = "******"; $hash = crypt($password); $io = Member::search(["member_nic" => "931390473"]); print_r($io); ///echo $hash; if (password_verify("nalinda", $hash)) { //echo strlen($hash); } else { echo "invalid"; } echo "test"; //echo date_format(date_add(DateTime::createFromFormat('d/m/Y', date("d/m/Y")),date_interval_create_from_date_string("5 years")),"d/m/Y"); echo date("d/m/Y"); $a = Item::search(["item_id" => 2]); print_r($a); $sql = "UPDATE item_copy SET item_copy_status=1;"; DB::getInstance()->directUpdate($sql); $data = array("id" => null, "purpose" => "sdasd", "comment" => "asdsdf", "member_id" => 16); $salt = '5&JDDlwz%Rwh!t2Yg-Igae@QxPzFTSId'; $enc_pass = md5($salt . 'admin'); echo "paswowkjhkfjw"; DB::getInstance()->directUpdate("UPDATE member SET member_password='******' WHERE member_nic='000000000';"); $t = new Transaction(); $t->create($data); $t->add(); print_r(DB::getInstance()->search("schedule", ["semester_no" => 2])); print_r(Schedule::search(["semester_no" => 2])); echo isset($_SESSION["basket"]); ?>
$member_role = $_SESSION['roles']; if (in_array("Laboratory Administrator", $member_role) || in_array("Related Lecturer", $member_role)) { } else { header('location:restricted_page.php'); } if (count($_POST) > 0) { //print_r($_POST); if (isset($_POST["reference"])) { $item_data = array("item_id" => $_POST["item_id"], "item_name" => $_POST["item_name"], "item_type" => $_POST["item_type"], "item_technical_details" => $_POST["item_tec_desc"], "item_description" => $_POST["item_desc"]); } else { $item_data = array("item_id" => $_POST["item_id"], "item_name" => $_POST["item_name"], "item_type" => $_POST["item_type"], "item_technical_details" => $_POST["item_tec_desc"], "item_description" => $_POST["item_desc"]); } //echo $_POST["itemTechDetEdit"]; $temp_path = $_FILES["item_picture"]["tmp_name"]; $img_type = pathinfo($_FILES["item_picture"]["name"], PATHINFO_EXTENSION); move_uploaded_file($temp_path, "img/items/" . $_POST["item_name"] . "." . "png"); //$_SESSION['form_data'] = $item_data; $_SESSION['form_data'] = $item_data; //header("Location: item_add.php",true,303); //die(); //print_r($item_data); $item_to_edit = Item::search(array("item_id" => $_POST["item_id"])); if ($item_to_edit->editItem($_SESSION['form_data'])) { $message = "You have successfully updated the item !!"; echo $message; } else { $message = "The Item update was unsuccessful."; echo $message; } unset($_SESSION["form_data"]); }
public function query() { $item = new Item($this->db); $loaditems = $item->search($this->f3->get('PARAMS.query'), $this->f3->get('searchlimit')); //template $this->f3->set('view', 'item/list.htm'); $this->f3->set('items', $loaditems); $this->f3->set('q', $this->f3->get('PARAMS.query')); //breadcrumbs $this->f3->set('breadcrumb', array(array("url" => NULL, "name" => "Search"))); $this->f3->set('header', $this->f3->get('PARAMS.query')); }
<?php /** * Created by PhpStorm. * User: samuel * Date: 3/19/2016 * Time: 1:25 AM */ include_once 'Item.php'; //include_once 'Admin.php'; include_once 'render_config.php'; session_start(); //$_SESSION['logged-in'] = false; $item = new Item(); if (isset($_GET['search'])) { $search = $_GET['search']; $skirts = $item->search($search); $as = $skirts->fetch_all(MYSQLI_ASSOC); $allSkirts['skirts'] = $as; echo $twig->render('index.twig', ['skirts' => $as]); } else { header('Location: index.php'); }
<?php require 'core/init.php'; if (array_key_exists("item_id", $_GET)) { $value = $_GET["item_id"]; $item = Item::search(array("item_id" => $value)); $itemName = $item->get_name(); $copies = $item->get_copies(); if (count($copies) > 0) { echo "<ul>"; foreach ($copies as $itemCopy) { $itemCopyId = $itemCopy->get_id(); $itemCopyNo = $itemCopy->get_no(); $itemCopyStatus = $itemCopy->get_status(); $itemCopyCondition = $itemCopy->get_condition(); $itemName = $itemCopy->get_item_name(); //$GLOBALS[$itemCopyNo]=""; //unset($GLOBALS[$itemCopyNo]); if (!in_array($itemCopyNo, $_SESSION["items"]) && $itemCopyStatus == 1) { $bgcolour = "#B3F5C2"; $draggable = "true"; $status = "Available"; $type = "button"; } else { $bgcolour = "#F23400"; $draggable = "false"; $status = "Not Available"; $type = "hidden"; } echo "<li class='node'><div id='" . $itemCopyNo . "' draggable=" . $draggable . " ondragstart=\"drag(event);\" style='border:1px solid #000000;padding:10px;background:" . $bgcolour . ";margin-right:30px;margin-top:5px;margin-left:30px'><img src='img/items/" . $itemName . ".png' height='80' width='80' align='left'/><b> Item Copy Name : </b>{$itemName}<br/><b> Item Copy No : </b>{$itemCopyNo}<br/><b> Condition : </b>{$itemCopyCondition}<br/><b>Status : </b>{$status}<br/><input type='" . $type . "' id='" . $itemCopyNo . "' value='Add to Basket' onclick='addToBasket(this.id);'/></div></li>"; }