/** * Provide link to publish a comment if user has edit rights * * @param string to display before link * @param string to display after link * @param string link text * @param string link title * @param string class name * @param string glue between url params * @param boolean save context? */ function get_publish_link($before = ' ', $after = ' ', $text = '#', $title = '#', $class = '', $glue = '&', $save_context = true) { global $current_User, $admin_url; if (!is_logged_in()) { return false; } $this->get_Item(); if ($this->status == 'published' || !$current_User->check_perm('blog_comments', '', false, $this->Item->get('blog_ID'))) { // If User has permission to edit comments: return false; } if ($text == '#') { $text = get_icon('publish', 'imgtag') . ' ' . T_('Publish!'); } if ($title == '#') { $title = T_('Publish this comment!'); } $r = $before; $r .= '<a href="'; $r .= $admin_url . '?ctrl=comments' . $glue . 'action=publish' . $glue . 'comment_ID=' . $this->ID; if ($save_context) { $r .= $glue . 'redirect_to=' . rawurlencode(regenerate_url('', '', '', '&')); } $r .= '" title="' . $title . '"'; if (!empty($class)) { $r .= ' class="' . $class . '"'; } $r .= '>' . $text . '</a>'; $r .= $after; return $r; }
public function startMap($map) { if ($map == "map1") { $this->mapsRunning["map1"] = "map1"; $hunter = array_rand($this->map1); unset($this->map1[$hunter]); $player = $this->getServer()->getPlayer($hunter); $this->getServer()->getPlayer($hunter)->teleport(new Vector3(108, 1, 165)); $player->getInventory()->setArmorItem("Head", Item::get(310)); $player->getInventory()->setArmorItem("Chest", Item::get(311)); $player->getInventory()->setArmorItem("Legs", Item::get(312)); $player->getInventory()->setArmorItem("Feet", Item::get(313)); $player->getInventory()->addItem(Item::get(276)); foreach ($this->getServer()->getOnlinePlayers() as $p) { if (isset($this->map1[$p->getName()])) { $p->teleport(new Vector3(121, 4, 157)); $p->sendPopup(TextFormat::GREEN . "Find a place to hide!"); $p->getInventory()->setArmorItem("Head", Item::get(298)); $p->getInventory()->setArmorItem("Chest", Item::get(299)); $p->getInventory()->setArmorItem("Legs", Item::get(300)); $p->getInventory()->setArmorItem("Feet", Item::get(334)); } } } }
function index() { $this->load->helper('url'); $items = new Item(); $items->get(); $data['items'] = $items; $this->load->view('welcome_message', $data); }
public function index() { $item = new Item(); $data['listings'] = $item->get(); // Create the view $this->template->title = 'Listings'; $this->template->content->view('marketplace/index', $data); $this->template->publish(); }
public function get_items($href, $pattern = null) { $cache = []; $root = $this->context->to_path($href); $paths = $this->get_paths($root, $pattern); $items = array_map(function ($path) { return Item::get($this->context, $path, $cache)->to_json_object(); }, $paths); return $items; }
function items_get() { $items = new Item(); $items->get(); $results = $this->object_to_array($items); if ($results) { $this->response($results, 200); // 200 being the HTTP response code } else { $this->response(array('error' => 'Couldn\'t find any items!'), 404); } }
public function get_content(&$cache) { $content = array(); if ($this->app->get_http_code($this->abs_href) !== App::$MAGIC_SEQUENCE) { return $content; } $files = $this->app->read_dir($this->abs_path); foreach ($files as $file) { $item = Item::get($this->app, $this->abs_path . "/" . $file, $cache); $content[$item->abs_path] = $item; } $this->is_content_fetched = true; return $content; }
public function get_content(&$cache) { $items = array(); if (!$this->app->is_managed_url($this->url)) { return $items; } $files = $this->app->read_dir($this->path); foreach ($files as $file) { $item = Item::get($this->app, $this->path . "/" . $file, $cache); $items[$item->path] = $item; } $this->is_content_fetched = true; return $items; }
public function get_content(&$cache) { $items = []; if (!$this->context->is_managed_href($this->href)) { return $items; } $files = $this->context->read_dir($this->path); foreach ($files as $file) { $item = Item::get($this->context, $this->path . '/' . $file, $cache); $items[$item->path] = $item; } $this->is_content_fetched = true; return $items; }
public function onInteract(PlayerInteractEvent $event) { // Item naming and enchantments will be in QuickHeal v1.5.0 — coming once MCPE v0.12 is publicly released. $config = $this->getConfig(); $player = $event->getPlayer(); $item = $config->get("id"); $playerhealth = $player->getHealth(); $health = $config->get("health"); $sethealth = $playerhealth + $health; if ($item == "282" and $playerhealth !== 20) { $id = 282; $damage = 0; $count = 1; $mstew = Item::get($id, $damage, $count); $player->setHealth($sethealth); $player->getInventory()->removeItem($mstew); $id = 281; $damage = 0; $count = 1; $bowl = Item::get($id, $damage, $count); $player->getInventory()->addItem($bowl); if ($item == "459" and $playerhealth !== 20) { $id = 459; $damage = 0; $count = 1; $bstew = Item::get($id, $damage, $count); $player->setHealth($sethealth); $player->getInventory()->removeItem($bstew); $id = 281; $damage = 0; $count = 1; $bowl = Item::get($id, $damage, $count); $player->getInventory()->addItem($bowl); } else { if ($item !== "282" or "459") { $damage = 0; $count = 1; $itemusing = Item::get($item, $damage, $count); $player->setHealth($sethealth); $player->getInventory()->removeItem($itemusing); // Implement custom addItem code in the future. } } } }
public function onInteract(PlayerInteractEvent $event) { // Proper item naming and enchantments will be in QuickHeal v1.5.0 — coming once PocketMine implements naming & enchantments. $config = $this->getConfig(); $player = $event->getPlayer(); $item = $config->get("id"); $playerHp = $player->getHealth(); $health = $config->get("health"); $healthPk = new SetHealthPacket(); $setHp->health = $playerHp + $health; if ($playerHp <= $player->getMaxHealth()) { $damage = 0; $count = 1; $removeItem = Item::get($item, $damage, $count); $player->dataPacket($setHp); $player->getInventory()->removeItem($removeItem); } }
public function onRun($currentTick) { $server = Server::getInstance(); $level = $server->getDefaultLevel(); $x = $this->plugin->config["x"]; $y = $this->plugin->config["y"]; $z = $this->plugin->config["z"]; $pos = new Vector3($x, $y, $z); $tile = $level->getTile($pos); $chest = Block::get(Block::CHEST); $items = array($this->plugin->config["contents"]); $contents = array_rand($items); $level->setBlock($pos, $chest); $tile->getInventory()->setContents([Item::get(Item::DIAMOND_SWORD), Item::get(Item::DIAMOND_PICKAXE)]); // ^ ($items[$contents]) $server->broadcastMessage("CRATE SPAWNED"); if ($chest->firstEmpty() == -1) { $air = Block::get(Block::AIR); $level->setBlock($pos, $air); } }
public function get_html($path = null) { if (!$path) { $path = $this->context->get_current_path(); } $fallback_images_href = $this->context->get_setup()->get('PUBLIC_HREF') . 'images/fallback/'; $cache = []; $folder = Item::get($this->context, $path, $cache); $items = $folder->get_content($cache); uasort($items, ['Item', 'cmp']); $html = '<table>'; $html .= '<tr>'; $html .= '<th class="fb-i"></th>'; $html .= '<th class="fb-n"><span>Name</span></th>'; $html .= '<th class="fb-d"><span>Last modified</span></th>'; $html .= '<th class="fb-s"><span>Size</span></th>'; $html .= '</tr>'; if ($folder->get_parent($cache)) { $html .= '<tr>'; $html .= '<td class="fb-i"><img src="' . $fallback_images_href . 'folder-parent.png" alt="folder-parent"/></td>'; $html .= '<td class="fb-n"><a href="..">Parent Directory</a></td>'; $html .= '<td class="fb-d"></td>'; $html .= '<td class="fb-s"></td>'; $html .= '</tr>'; } foreach ($items as $item) { $type = $item->is_folder ? 'folder' : 'file'; $html .= '<tr>'; $html .= '<td class="fb-i"><img src="' . $fallback_images_href . $type . '.png" alt="' . $type . '"/></td>'; $html .= '<td class="fb-n"><a href="' . $item->href . '">' . basename($item->path) . '</a></td>'; $html .= '<td class="fb-d">' . date('Y-m-d H:i', $item->date) . '</td>'; $html .= '<td class="fb-s">' . ($item->size !== null ? intval($item->size / 1000) . ' KB' : '') . '</td>'; $html .= '</tr>'; } $html .= '</table>'; return $html; }
public function beforeSave() { if (!$this->id) { $event = new Event(['cart_id' => $this->cart_id, 'user_id' => \Users\User::$cur->id, 'cart_event_type_id' => 1, 'info' => $this->item_offer_price_id]); $event->save(); } else { $cur = Item::get($this->id); if ($cur->item_id != $this->item_id) { $event = new Event(['cart_id' => $this->cart->cart_id, 'user_id' => \Users\User::$cur->id, 'cart_event_type_id' => 2, 'info' => $cur->item_offer_price_id]); $event->save(); $event = new Event(['cart_id' => $this->cart->cart_id, 'user_id' => \Users\User::$cur->id, 'cart_event_type_id' => 1, 'info' => $this->item_offer_price_id]); $event->save(); } else { if ($cur->item_offer_price_id != $this->item_offer_price_id) { $event = new Event(['cart_id' => $this->cart->cart_id, 'user_id' => \Users\User::$cur->id, 'cart_event_type_id' => 3, 'info' => $this->item_offer_price_id]); $event->save(); } if ($cur->count != $this->count) { $event = new Event(['cart_id' => $this->cart->cart_id, 'user_id' => \Users\User::$cur->id, 'cart_event_type_id' => 4, 'info' => $this->item_offer_price_id . "|" . ($this->count - $cur->count)]); $event->save(); } } } }
public function setMine(&$output = null) { $send = false; $level = $this->sectionpos1->getLevel(); $bcnt = 1; $startX = min($this->sectionpos1->x, $this->sectionpos2->x); $endX = max($this->sectionpos1->x, $this->sectionpos2->x); $startY = min($this->sectionpos1->y, $this->sectionpos2->y); $endY = max($this->sectionpos1->y, $this->sectionpos2->y); $startZ = min($this->sectionpos1->z, $this->sectionpos2->z); $endZ = max($this->sectionpos1->z, $this->sectionpos2->z); $count = 0; for ($x = $startX; $x <= $endX; ++$x) { for ($y = $startY; $y <= $endY; ++$y) { for ($z = $startZ; $z <= $endZ; ++$z) { $direct = false; $update = false; if (rand(1, 8) == 1) { $block = Item::get(Item::TNT)->getBlock(); } else { $block = Item::get(Item::DIRT)->getBlock(); $key = $x . "." . $y . "." . $z; $this->getPlugin()->notblocks[$key] = $block; } $level->setBlock(new Position($x, $y, $z), $block, $direct, $update); $count++; } } } $output .= "{$count} block(s) have been updated.\n"; return true; }
public function get_items($href, $what) { if (!$this->is_managed_href($href)) { return []; } $cache = []; $folder = Item::get($this, $this->to_path($href), $cache); // add content of subfolders if ($what >= 2 && $folder !== null) { foreach ($folder->get_content($cache) as $item) { $item->get_content($cache); } $folder = $folder->get_parent($cache); } // add content of this folder and all parent folders while ($what >= 1 && $folder !== null) { $folder->get_content($cache); $folder = $folder->get_parent($cache); } uasort($cache, ['Item', 'cmp']); $result = []; foreach ($cache as $p => $item) { $result[] = $item->to_json_object(); } return $result; }
public function showReservation($id) { $reservation = Reservation::find($id); if (!$reservation) { return Redirect::back()->withErrors('Could not find reservation.'); } $date1 = new DateTime($reservation->reservation_start); $date2 = new DateTime($reservation->reservation_end); $date3 = new DateTime($reservation->date_request); $diff = $date2->diff($date1)->format("%a"); $diff += 1; $date1 = date_format($date1, 'l, jS F Y'); $date2 = date_format($date2, 'l, jS F Y'); $date3 = date_format($date3, 'F j, Y'); $categories = Category::all(); $packages = Packages::all(); $item = Item::get(); return View::make('admin.showReservation', compact('item', 'packages', 'categories', 'id', 'diff', 'reservation', 'date1', 'date2', 'date3')); }
public function onLevelChange(EntityLevelChangeEvent $event) { echo __METHOD__ . "," . __LINE__ . "\n"; if ($event->isCancelled()) { return; } $player = $event->getEntity(); if (!$player instanceof Player) { return; } if ($player->isCreative()) { return; } if (!$this->saveInventory($player, $event->getOrigin())) { return; } $player->getInventory()->clearAll(); if (!$this->loadInventory($player, $event->getTarget())) { return; } $slot = $this->getConfig()->get("slot"); $item = $this->getConfig()->get("ID"); $damage = $this->getConfig()->get("Damage"); $ammount = $this->getConfig()->get("Ammount"); $level = $event->getLevel(); $world = $this->getConfig()->get("world"); if ($level == $world && $slot <= 35) { $player->getInventory()->setItem($slot, Item::get($item, $damage, $ammount)); } $slot = $this->getConfig()->get("slot2"); $item = $this->getConfig()->get("ID2"); $damage = $this->getConfig()->get("Damage2"); $ammount = $this->getConfig()->get("Ammount2"); $level = $event->getLevel(); $world = $this->getConfig()->get("world"); if ($level == $world && $slot <= 35) { $player->getInventory()->setItem($slot, Item::get($item, $damage, $ammount)); } $slot = $this->getConfig()->get("slot3"); $item = $this->getConfig()->get("ID3"); $damage = $this->getConfig()->get("Damage3"); $ammount = $this->getConfig()->get("Ammount3"); $level = $event->getLevel(); $world = $this->getConfig()->get("world"); if ($level == $world && $slot <= 35) { $player->getInventory()->setItem($slot, Item::get($item, $damage, $ammount)); } $slot = $this->getConfig()->get("slot4"); $item = $this->getConfig()->get("ID4"); $damage = $this->getConfig()->get("Damage4"); $ammount = $this->getConfig()->get("Ammount4"); $level = $event->getLevel(); $world = $this->getConfig()->get("world"); if ($level == $world && $slot <= 35) { $player->getInventory()->setItem($slot, Item::get($item, $damage, $ammount)); } $slot = $this->getConfig()->get("slot5"); $item = $this->getConfig()->get("ID5"); $damage = $this->getConfig()->get("Damage5"); $ammount = $this->getConfig()->get("Ammount5"); $level = $event->getLevel(); $world = $this->getConfig()->get("world"); if ($level == $world && $slot <= 35) { $player->getInventory()->setItem($slot, Item::get($item, $damage, $ammount)); } $slot = $this->getConfig()->get("slot6"); $item = $this->getConfig()->get("ID6"); $damage = $this->getConfig()->get("Damage6"); $ammount = $this->getConfig()->get("Ammount6"); $level = $event->getLevel(); $world = $this->getConfig()->get("world"); if ($level == $world && $slot <= 35) { $player->getInventory()->setItem($slot, Item::get($item, $damage, $ammount)); } $slot = $this->getConfig()->get("slot7"); $item = $this->getConfig()->get("ID7"); $damage = $this->getConfig()->get("Damage7"); $ammount = $this->getConfig()->get("Ammount7"); $level = $event->getLevel(); $world = $this->getConfig()->get("world"); if ($level == $world && $slot <= 35) { $player->getInventory()->setItem($slot, Item::get($item, $damage, $ammount)); } $slot = $this->getConfig()->get("slot8"); $item = $this->getConfig()->get("ID8"); $damage = $this->getConfig()->get("Damage8"); $ammount = $this->getConfig()->get("Ammount8"); $level = $event->getLevel(); $world = $this->getConfig()->get("world"); if ($level == $world && $slot <= 35) { $player->getInventory()->setItem($slot, Item::get($item, $damage, $ammount)); } $slot = $this->getConfig()->get("slot9"); $item = $this->getConfig()->get("ID9"); $damage = $this->getConfig()->get("Damage9"); $ammount = $this->getConfig()->get("Ammount9"); $level = $event->getLevel(); $world = $this->getConfig()->get("world"); if ($level == $world && $slot <= 35) { $player->getInventory()->setItem($slot, Item::get($item, $damage, $ammount)); } $slot = $this->getConfig()->get("slot10"); $item = $this->getConfig()->get("ID10"); $damage = $this->getConfig()->get("Damage10"); $ammount = $this->getConfig()->get("Ammount10"); $level = $event->getLevel(); $world = $this->getConfig()->get("world"); if ($level == $world && $slot <= 35) { $player->getInventory()->setItem($slot, Item::get($item, $damage, $ammount)); } }
public function get_fallback() { $cache = array(); $folder = Item::get($this, CURRENT_PATH, $cache); $items = $folder->get_content($cache); uasort($items, array("Item", "cmp")); $html = "<table>"; $html .= "<tr>"; $html .= "<th class='fb-i'></th>"; $html .= "<th class='fb-n'><span>Name</span></th>"; $html .= "<th class='fb-d'><span>Last modified</span></th>"; $html .= "<th class='fb-s'><span>Size</span></th>"; $html .= "</tr>"; if ($folder->get_parent($cache)) { $html .= "<tr>"; $html .= "<td class='fb-i'><img src='" . APP_HREF . "client/images/fallback/folder-parent.png' alt='folder-parent'/></td>"; $html .= "<td class='fb-n'><a href='..'>Parent Directory</a></td>"; $html .= "<td class='fb-d'></td>"; $html .= "<td class='fb-s'></td>"; $html .= "</tr>"; } foreach ($items as $item) { $type = $item->is_folder ? "folder" : "file"; $html .= "<tr>"; $html .= "<td class='fb-i'><img src='" . APP_HREF . "client/images/fallback/" . $type . ".png' alt='" . $type . "'/></td>"; $html .= "<td class='fb-n'><a href='" . $item->url . "'>" . basename($item->path) . "</a></td>"; $html .= "<td class='fb-d'>" . date("Y-m-d H:i", $item->date) . "</td>"; $html .= "<td class='fb-s'>" . ($item->size !== null ? intval($item->size / 1000) . " KB" : "") . "</td>"; $html .= "</tr>"; } $html .= "</table>"; return $html; }
public function onCommand(CommandSender $sender, Command $command, $label, array $args) { switch ($command->getName()) { case "prison": if ($sender instanceof Player) { if (count($args) == "help") { // prison random // prison exit // prison arena // prison kit // prison info $sender->sendMessage(TextFormat::GREEN . "Prison command" . TextFormat::YELLOW . "\n" . "use /prison random -> teleport to random cell" . "\n" . "/prison exit -> teleport to lobby" . "/n" . "/prison arena -> teleport to arena pvp" . "/n" . "/prison kit <name> -> give kit for survival" . "/n" . "/prison info <kit> -> give info in chat a player"); } else { if (count($args) == "random") { $event->getPlayer()->teleport($this->getRandomLocation()); } else { if (count($args) == "exit") { $this->getServer()->getPlayer()->teleport(new Vector3($this->yml["lobby_x"], $this->yml["lobby_y"], $this->yml["lobby_z"])); } else { if (count($args) == "arena") { $this->getServer()->getPlayer()->teleport(new Vector3($this->yml["arena_x"], $this->yml["arena_y"], $this->yml["arena_z"])); } else { if (count($args) == "kit") { if ($this->getServer()->getPlayer() == "robozeri" || "owner" || "altro") { $sword = Item::get(276, 1, 1); $armor1 = Item::get(310, 1, 1); $armor2 = Item::get(311, 1, 1); $armor3 = Item::get(312, 1, 1); $armor4 = Item::get(313, 1, 1); $player->getInventory()->addItem($sword); $player->getInventory()->addItem($armor1); $player->getInventory()->addItem($armor2); $player->getInventory()->addItem($armor3); $player->getInventory()->addItem($armor4); } else { $sword = Item::get(276, 1, 1); $armor1n = Item::get(310, 1, 1); $armor2n = Item::get(311, 1, 1); $armor3n = Item::get(312, 1, 1); $armor4n = Item::get(313, 1, 1); $player->getInventory()->addItem($sword); $player->getInventory()->addItem($armor1n); $player->getInventory()->addItem($armor2n); $player->getInventory()->addItem($armor3n); $player->getInventory()->addItem($armor4n); } } } } } } return true; } break; case "setcell": $this->addNewLocation($sender->getLocation()); $sender->sendMessage("added the xyz!"); $sender->sendMessage("" . $this->getNumberOfPositions() . "POS."); return true; break; } }
<?php /* requires $itemid */ $itemid = $itemrow['id']; $allitems[$itemid] = $itemrow; $itemname = $itemrow['name']; $itemdesc = $itemrow['description']; $itemprice = $itemrow['price']; $item = Item::get($itemid); $imageid = $itemrow['imageid']; //$imagerow = $item->getPrimaryImage(); //if (count($imagerow) == 1) { // $allitems[$itemid]['primaryimage'] = $imagerow[0]; //} if (!!$imageid) { $image = Image::get($imageid); $image50 = $image->getProperty('sq50'); $image150 = $image->getProperty('sq150'); $image300 = $image->getProperty('sq300'); $image500 = $image->getProperty('sq500'); } else { $image50 = null; $image150 = null; $image300 = null; $image500 = null; }
?> <h4>Items that use this image</h4> <table class="linkeditemtable table table-stipped table-bordered"> <thead> <tr><th>Menu Name</th> <th>Category Name</th> <th>Item Name</th> <th>Unlink Item</th> </tr> </thead> <tbody> <?php foreach ($items as $itemrow) { $itemid = $itemrow['id']; $itemname = $itemrow['name']; $item = Item::get($itemid, $userid); $category = $item->getCategory(); $categoryname = $category[0]['name']; $menu = $item->getMenu(); $menuname = $menu[0]['name']; ?> <tr> <td><?php echo $menuname; ?> </td> <td><?php echo $categoryname; ?> </td> <td><?php
<th>Subcategory</th> <th>Item</th> <th>Price</th> </tr> </thead> <tbody> <?php $items = $menu->getItems(); foreach ($items as $itemrow) { $itemcategoryid = ''; $itemcategoryname = ''; $itemcategorydesc = ''; $itemsubcategoryid = ''; $itemsubcategoryname = ''; $itemsubcategorydesc = ''; $item = Item::get($itemrow['id'], $userid); $itemcategoryid = $item->getProperty('categoryid'); $itemcategory = Category::get($itemcategoryid, $userid); $itemcategoryname = $itemcategory->getProperty('name'); $itemcategorydesc = $itemcategory->getProperty('description'); if ($itemcategory->hasParent()) { $itemsubcategory = $itemcategory; $itemsubcategoryid = $itemcategoryid; $itemsubcategoryname = $itemcategoryname; $itemsubcategorydesc = $itemcategorydesc; $itemcategoryid = $itemcategory->getProperty('parentid'); $itemcategory = Category::get($itemcategoryid, $userid); $itemcategoryname = $itemcategory->getProperty('name'); $itemcategorydesc = $itemcategory->getProperty('description'); } echo ' <tr>';
echo ' <ul>'; echo ' <li><a href="#comments" data-ajax="false" data-icon="comment"></a></li>'; echo ' <li><a href="#hearts" data-ajax="false" data-icon="heart"></a></li>'; echo ' <li><a href="#photos" data-ajax="false" data-icon="camera"></a></li>'; echo ' </ul>'; echo ' </div>'; echo ' <div id="comments">'; echo ' <a href="#" class="ui-btn ui-nodisc-icon ui-alt-icon ui-icon-comment ui-btn-icon-right">Post a comment.</a>'; echo ' <h3>Comments</h3>'; echo ' </div>'; echo ' <div id="hearts">'; echo ' <a href="#" class="ui-btn ui-nodisc-icon ui-alt-icon ui-icon-heart ui-btn-icon-right">Heart it.</a>'; echo ' <h3>They love it</h3>'; echo ' </div>'; //photos tab $aitem = Item::get($allitemid); $aiimages = $aitem->getImages(); if (count($aiimages) > 0) { $takephotobtntext = 'Take a photo.'; } else { $takephotobtntext = 'Take the first photo.'; } echo ' <div id="photos">'; echo ' <a href="#" class="ui-btn ui-nodisc-icon ui-alt-icon ui-icon-camera ui-btn-icon-right">' . $takephotobtntext . '</a>'; if (array_key_exists('primaryimage', $allitemrow)) { $aiimage300sq = $allitemrow['primaryimage']['sq300']; if (!!$aiimage300sq) { echo ' <img class="primaryitemimage" src="img/' . $aiimage300sq . '">'; } } echo ' <div class="itemimages">';
private function showItems($year, $month, $day) { $this->load->library('jdf'); if (!checkdate($month, $day, $year)) { show_error("data_wrong", 400); return; } $week = getWholeWeek($year, $month, $day); $item = new Item(); $item->where("start >= ", getSaturday($year, $month, $day)); $item->where("end < ", getSaturday($year, $month, $day + 7)); $item->where("user_id", $this->session->getStudentId()); $item->get(); $items = $this->setFormat($item); $this->load->view("item/get", array("items" => $items, "week" => $week)); }
public function getResidue() { return Item::get(Item::BOWL); }
public function get_content(&$cache) { $items = array(); if (!$this->app->is_managed_url($this->url)) { return $items; } $files = $this->app->read_dir($this->path); $options = $this->app->get_options(); foreach ($files as $file) { if ($options["view"]["loadsubconf"] && $file == "options.json") { $this->app->set_options($this->path . "/" . $file); } else { $item = Item::get($this->app, $this->path . "/" . $file, $cache); $items[$item->path] = $item; } } $this->is_content_fetched = true; return $items; }
// Params we need for tab switching: $tab_switch_params = 'blog=' . $blog; break; case 'copy': // Duplicate post $item_ID = param('p', 'integer', true); $ItemCache =& get_ItemCache(); $edited_Item =& $ItemCache->get_by_ID($item_ID); $edited_Item->load_Blog(); $item_status = $edited_Item->Blog->get_allowed_item_status(); $edited_Item->set('status', $item_status); $edited_Item->set('dateset', 0); // Date not explicitly set yet $edited_Item->set('issue_date', date('Y-m-d H:i:s', $localtimenow)); // Set post comment status and extracats $post_comment_status = $edited_Item->get('comment_status'); $post_extracats = postcats_get_byID($p); // Check if new category was started to create. If yes then set up parameters for next page check_categories_nosave($post_category, $post_extracats); // Page title: switch ($edited_Item->ptyp_ID) { case 1000: $title = T_('Duplicate page'); break; case 1600: $title = T_('Duplicate intro'); break; case 2000: $title = T_('Duplicate podcast episode'); break; case 3000:
public function remove_item($book_id) { $item = new Item(); $item->get("book_id = {$book_id} AND cart_id = " . $this->id); $item->delete(); }
public function get_fallback() { date_default_timezone_set("UTC"); $cache = array(); $folder = Item::get($this, $this->abs_path, $cache); $items = $folder->get_content($cache); uasort($items, array("Item", "cmp")); $html = "<table>"; $html .= "<tr>"; $html .= "<th></th>"; $html .= "<th><span>Name</span></th>"; $html .= "<th><span>Last modified</span></th>"; $html .= "<th><span>Size</span></th>"; $html .= "</tr>"; if ($folder->get_parent($cache)) { $html .= "<tr>"; $html .= "<td><img src='" . $this->app_abs_href . "client/icons/96/folder-parent.png' alt='folder-parent'/></td>"; $html .= "<td><a href='..'>Parent Directory</a></td>"; $html .= "<td></td>"; $html .= "<td></td>"; $html .= "</tr>"; } foreach ($items as $item) { $type = $item->is_folder ? "folder" : "default"; $html .= "<tr>"; $html .= "<td><img src='" . $this->app_abs_href . "client/icons/96/" . $type . ".png' alt='" . $type . "'/></td>"; $html .= "<td><a href='" . $item->abs_href . "'>" . basename($item->abs_path) . "</a></td>"; $html .= "<td>" . date("Y-m-d H:i", $item->date) . "</td>"; $html .= "<td>" . ($item->size !== null ? intval($item->size / 1000) . " KB" : "") . "</td>"; $html .= "</tr>"; } $html .= "</table>"; return $html; }