• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP item类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: adicionarItem

 public function adicionarItem($quantidadeItem, $valorItem)
 {
     $item = new item();
     $item->setQuantidade($quantidadeItem);
     $item->setValor($valorItem);
     $this->itens[] = $item;
 }
开发者ID:geovanecomp,项目名称:Giga,代码行数:7,代码来源:Pedido.php


示例2: onActivate

 public function onActivate(item $item, Player $player = null)
 {
     $tile = $this->getLevel()->getTile($this);
     if ($tile instanceof FlowerPotTile) {
         if ($tile->getFlowerPotItem() === item::AIR) {
             switch ($item->getId()) {
                 case item::TALL_GRASS:
                     if ($item->getDamage() === 1) {
                         break;
                     }
                 case item::SAPLING:
                 case item::DEAD_BUSH:
                 case item::DANDELION:
                 case item::RED_FLOWER:
                 case item::BROWN_MUSHROOM:
                 case item::RED_MUSHROOM:
                 case item::CACTUS:
                     $tile->setFlowerPotData($item->getId(), $item->getDamage());
                     if ($player->isSurvival()) {
                         $item->count--;
                     }
                     return true;
                     break;
             }
         }
     }
     return false;
 }
开发者ID:ClearSkyTeam,项目名称:ClearSky,代码行数:28,代码来源:FlowerPot.php


示例3: show_overdue

function show_overdue($template_name)
{
    global $db;
    global $TPL;
    $current_user =& singleton("current_user");
    $db = new db_alloc();
    $temp = mktime(0, 0, 0, date("m"), date("d"), date("Y"));
    $today = date("Y", $temp) . "-" . date("m", $temp) . "-" . date("d", $temp);
    $q = prepare("SELECT itemName,itemType,item.itemID,dateBorrowed,dateToBeReturned,loan.personID \n                  FROM loan,item \n                 WHERE dateToBeReturned < '%s' \n\t\t\t\t\t         AND dateReturned = '0000-00-00' \n\t\t\t\t\t         AND item.itemID = loan.itemID\n               ", $today);
    if (!have_entity_perm("loan", PERM_READ, $current_user, false)) {
        $q .= prepare("AND loan.personID = %d", $current_user->get_id());
    }
    $db->query($q);
    while ($db->next_record()) {
        $i++;
        $item = new item();
        $loan = new loan();
        $item->read_db_record($db);
        $loan->read_db_record($db);
        $item->set_values();
        $loan->set_values();
        $person = new person();
        $person->set_id($loan->get_value("personID"));
        $person->select();
        $TPL["person"] = $person->get_name();
        $TPL["overdue"] = "<a href=\"" . $TPL["url_alloc_item"] . "itemID=" . $item->get_id() . "&return=true\">Overdue!</a>";
        include_template($template_name);
    }
}
开发者ID:cjbayliss,项目名称:alloc,代码行数:29,代码来源:itemLoan.php


示例4: addItem

 /**
  * Adds item to the business table.
  */
 public function addItem()
 {
     $item = new item();
     $item->createItem($this->input->post(NULL, TRUE));
     $bname = $this->session->userdata('bname');
     $item->bname = $bname;
     if ($this->db->insert('chkitem', $item)) {
         $items = $this->item->getItems($bname);
         echo $this->load->view('templates/item_table', array('items' => $items));
     }
 }
开发者ID:CapstoneFleetIntelligience,项目名称:Fleet,代码行数:14,代码来源:admin_controller.php


示例5: load

 public function load()
 {
     $db = db::obtain();
     $items = array();
     $items_info = $db->fetch_array_pdo('SELECT * FROM ' . db::real_tablename('items'));
     foreach ($items_info as $item_info) {
         $item = new item();
         $item->set_array($item_info);
         $items[$item_info['id']] = $item;
     }
     return $items;
 }
开发者ID:digomes,项目名称:dota2-api,代码行数:12,代码来源:class.items_mapper_db.php


示例6: getItems

 /**
  * Ruft Liste von Text-Sperren ab
  * @return array
  */
 public function getItems()
 {
     $list = $this->dbcon->fetch($this->dbcon->select($this->table), true);
     $res = array();
     foreach ($list as $item) {
         $wbItem = new item();
         if ($wbItem->createFromDbObject($item)) {
             $res[$wbItem->getId()] = $wbItem;
         }
     }
     return $res;
 }
开发者ID:sea75300,项目名称:fanpresscm3,代码行数:16,代码来源:items.php


示例7: show_items

function show_items($template_name)
{
    global $TPL;
    global $db;
    global $db2;
    $current_user =& singleton("current_user");
    $today = date("Y") . "-" . date("m") . "-" . date("d");
    $dbUsername = new db_alloc();
    $db = new db_alloc();
    $db2 = new db_alloc();
    $db->query("select * from item order by itemName");
    while ($db->next_record()) {
        $i++;
        $item = new item();
        $item->read_db_record($db);
        $db2->query("select * from loan where itemID=" . $item->get_id() . " and dateReturned='0000-00-00'");
        $db2->next_record();
        $loan = new loan();
        $loan->read_db_record($db2);
        $item->set_values();
        // you need to have this repeated here for the a href bit below.
        if ($loan->get_value("dateReturned") == "0000-00-00") {
            if ($loan->have_perm(PERM_READ_WRITE)) {
                // if item is overdue
                if ($loan->get_value("dateToBeReturned") < $today) {
                    $ret = "Return Now!";
                } else {
                    $ret = "Return";
                }
                $TPL["itemAction"] = "<td><a href=\"" . $TPL["url_alloc_item"] . "itemID=" . $TPL["itemID"] . "&return=true\">{$ret}</a></td>";
            } else {
                // if you don't have permission to borrow or return item.
                $TPL["itemAction"] = "<td>&nbsp;</td>";
            }
            $TPL["status"] = "Due " . $loan->get_value("dateToBeReturned");
            $dbUsername->query("select username from person where personID=" . $loan->get_value("personID"));
            $dbUsername->next_record();
            $TPL["person"] = "from " . $dbUsername->f("username");
        } else {
            // if the item is available
            $TPL["status"] = "Available";
            $TPL["person"] = "";
            $TPL["itemAction"] = "<td><a href=\"" . $TPL["url_alloc_item"] . "itemID=" . $TPL["itemID"] . "&borrow=true\">Borrow</a></td>";
            $TPL["dueBack"] = "";
        }
        $loan->set_values();
        $item->set_values();
        include_template($template_name);
    }
}
开发者ID:cjbayliss,项目名称:alloc,代码行数:50,代码来源:loanAndReturn.php


示例8: add_photo

 public function add_photo($id)
 {
     $album = ORM::factory("item", $id);
     access::required("view", $album);
     access::required("add", $album);
     access::verify_csrf();
     $file_validation = new Validation($_FILES);
     $file_validation->add_rules("Filedata", "upload::valid", "upload::type[gif,jpg,png,flv,mp4]");
     if ($file_validation->validate()) {
         // SimpleUploader.swf does not yet call /start directly, so simulate it here for now.
         if (!batch::in_progress()) {
             batch::start();
         }
         $temp_filename = upload::save("Filedata");
         try {
             $name = substr(basename($temp_filename), 10);
             // Skip unique identifier Kohana adds
             $title = item::convert_filename_to_title($name);
             $path_info = pathinfo($temp_filename);
             if (array_key_exists("extension", $path_info) && in_array(strtolower($path_info["extension"]), array("flv", "mp4"))) {
                 $movie = movie::create($album, $temp_filename, $name, $title);
                 log::success("content", t("Added a movie"), html::anchor("movies/{$movie->id}", t("view movie")));
             } else {
                 $photo = photo::create($album, $temp_filename, $name, $title);
                 log::success("content", t("Added a photo"), html::anchor("photos/{$photo->id}", t("view photo")));
             }
         } catch (Exception $e) {
             unlink($temp_filename);
             throw $e;
         }
         unlink($temp_filename);
     }
     print "File Received";
 }
开发者ID:krgeek,项目名称:gallery3,代码行数:34,代码来源:simple_uploader.php


示例9: index

 public function index()
 {
     if (isset($_GET['cw'])) {
         setcookie('cw_agree', '1', time() + 60 * 60 * 24, '/');
         url::redirect(item::root()->abs_url());
     }
 }
开发者ID:webmatter,项目名称:gallery3-contrib,代码行数:7,代码来源:content_warning.php


示例10: createFile

 public function createFile($name, $data = null)
 {
     try {
         access::required("view", $this->item);
         access::required("add", $this->item);
     } catch (Kohana_404_Exception $e) {
         throw new Sabre_DAV_Exception_Forbidden("Access denied");
     }
     if (substr($name, 0, 1) == ".") {
         return true;
     }
     try {
         $tempfile = tempnam(TMPPATH, "dav");
         $target = fopen($tempfile, "wb");
         stream_copy_to_stream($data, $target);
         fclose($target);
         $item = ORM::factory("item");
         $item->name = $name;
         $item->title = item::convert_filename_to_title($item->name);
         $item->description = "";
         $item->parent_id = $this->item->id;
         $item->set_data_file($tempfile);
         $item->type = "photo";
         $item->save();
     } catch (Exception $e) {
         unlink($tempfile);
         throw $e;
     }
 }
开发者ID:webmatter,项目名称:gallery3-contrib,代码行数:29,代码来源:Gallery3_DAV_Album.php


示例11: random

 public function random($item_id)
 {
     $item = ORM::factory("item", $item_id);
     access::required("view", $item);
     item::set_display_context_callback("Albums_Controller::get_display_context");
     url::redirect($item->abs_url());
 }
开发者ID:JasonWiki,项目名称:docs,代码行数:7,代码来源:image_block.php


示例12: user_created

 /**
  * Create an album for the newly created user and give him view and edit permissions.
  */
 static function user_created($user)
 {
     // Create a group with the same name, if necessary
     $group_name = "auto: {$user->name}";
     $group = identity::lookup_group_by_name($group_name);
     if (!$group) {
         $group = identity::create_group($group_name);
         identity::add_user_to_group($user, $group);
     }
     // Create an album for the user, if it doesn't exist
     $album = ORM::factory("item")->where("parent_id", "=", item::root()->id)->where("name", "=", $user->name)->find();
     if (!$album->loaded()) {
         $album->type = "album";
         $album->name = $user->name;
         $album->title = "{$user->name}'s album";
         $album->parent_id = item::root()->id;
         $album->sort_column = "weight";
         $album->sort_order = "asc";
         $album->save();
         access::allow($group, "view", item::root());
         access::allow($group, "view_full", $album);
         access::allow($group, "edit", $album);
         access::allow($group, "add", $album);
     }
 }
开发者ID:Glooper,项目名称:gallery3-contrib,代码行数:28,代码来源:user_albums_event.php


示例13: get_test

 public function get_test()
 {
     $tag = tag::add(item::root(), "tag1")->reload();
     $request = new stdClass();
     $request->url = rest::url("tag", $tag);
     $this->assert_equal_array(array("url" => rest::url("tag", $tag), "entity" => $tag->as_array(), "relationships" => array("items" => array("url" => rest::url("tag_items", $tag), "members" => array(rest::url("tag_item", $tag, item::root()))))), tag_rest::get($request));
 }
开发者ID:kandsten,项目名称:gallery3,代码行数:7,代码来源:Tag_Rest_Helper_Test.php


示例14: site_menu

 static function site_menu($menu, $theme)
 {
     if ($theme->page_type != "login") {
         $menu->append(Menu::factory("link")->id("home")->label(t("Home"))->url(item::root()->url()));
         $item = $theme->item();
         $can_edit = $item && access::can("edit", $item);
         $can_add = $item && access::can("add", $item);
         if ($can_add) {
             $menu->append($add_menu = Menu::factory("submenu")->id("add_menu")->label(t("Add")));
             $add_menu->append(Menu::factory("dialog")->id("add_photos_item")->label(t("Add photos"))->url(url::site("simple_uploader/app/{$item->id}")));
             if ($item->is_album()) {
                 $add_menu->append(Menu::factory("dialog")->id("add_album_item")->label(t("Add an album"))->url(url::site("form/add/albums/{$item->id}?type=album")));
             }
         }
         $menu->append($options_menu = Menu::factory("submenu")->id("options_menu")->label(t("Photo options")));
         if ($item && ($can_edit || $can_add)) {
             if ($can_edit) {
                 $options_menu->append(Menu::factory("dialog")->id("edit_item")->label($item->is_album() ? t("Edit album") : t("Edit photo"))->url(url::site("form/edit/{$item->type}s/{$item->id}")));
             }
             if ($item->is_album()) {
                 $options_menu->label(t("Album options"));
                 if ($can_edit) {
                     $options_menu->append(Menu::factory("dialog")->id("edit_permissions")->label(t("Edit permissions"))->url(url::site("permissions/browse/{$item->id}")));
                 }
             }
         }
         if (user::active()->admin) {
             $menu->append($admin_menu = Menu::factory("submenu")->id("admin_menu")->label(t("Admin")));
             gallery::admin_menu($admin_menu, $theme);
             module::event("admin_menu", $admin_menu, $theme);
         }
         module::event("site_menu", $menu, $theme);
     }
 }
开发者ID:roypa,项目名称:bbg,代码行数:34,代码来源:gallery.php


示例15: get

 static function get($block_id, $theme)
 {
     $block = "";
     switch ($block_id) {
         case "random_image":
             // The random_query approach is flawed and doesn't always return a
             // result when there actually is one. Retry a *few* times.
             // @todo Consider another fallback if further optimizations are necessary.
             $image_count = module::get_var("image_block", "image_count");
             $items = array();
             for ($i = 0; $i < $image_count; $i++) {
                 $attempts = 0;
                 $item = null;
                 do {
                     $item = item::random_query()->where("type", "!=", "album")->find_all(1)->current();
                 } while (!$item && $attempts++ < 3);
                 if ($item) {
                     $items[] = $item;
                 }
             }
             if ($items) {
                 $block = new Block();
                 $block->css_id = "g-image-block";
                 $block->title = t2("Random image", "Random images", $image_count);
                 $block->content = new View("image_block_block.html");
                 $block->content->items = $items;
             }
             break;
     }
     return $block;
 }
开发者ID:Joe7,项目名称:gallery3,代码行数:31,代码来源:image_block_block.php


示例16: feed

 static function feed($feed_id, $offset, $limit, $id)
 {
     $feed = new stdClass();
     switch ($feed_id) {
         case "latest":
             $feed->items = ORM::factory("item")->viewable()->where("type", "<>", "album")->order_by("created", "DESC")->find_all($limit, $offset);
             $all_items = ORM::factory("item")->viewable()->where("type", "<>", "album")->order_by("created", "DESC");
             $feed->max_pages = ceil($all_items->find_all()->count() / $limit);
             $feed->title = t("%site_title - Recent updates", array("site_title" => item::root()->title));
             $feed->description = t("Recent updates");
             return $feed;
         case "album":
             $item = ORM::factory("item", $id);
             access::required("view", $item);
             $feed->items = $item->viewable()->descendants($limit, $offset, array(array("type", "=", "photo")));
             $feed->max_pages = ceil($item->viewable()->descendants_count(array(array("type", "=", "photo"))) / $limit);
             if ($item->id == item::root()->id) {
                 $feed->title = html::purify($item->title);
             } else {
                 $feed->title = t("%site_title - %item_title", array("site_title" => item::root()->title, "item_title" => $item->title));
             }
             $feed->description = nl2br(html::purify($item->description));
             return $feed;
     }
 }
开发者ID:Joe7,项目名称:gallery3,代码行数:25,代码来源:gallery_rss.php


示例17: get

 /**
  * For items that are collections, you can specify the following additional query parameters to
  * query the collection.  You can specify them in any combination.
  *
  *   scope=direct
  *     only return items that are immediately under this one
  *   scope=all
  *     return items anywhere under this one
  *
  *   name=<substring>
  *     only return items where the name contains this substring
  *
  *   random=true
  *     return a single random item
  *
  *   type=<comma separate list of photo, movie or album>
  *     limit the type to types in this list.  eg, "type=photo,movie"
  */
 static function get($request)
 {
     $item = rest::resolve($request->url);
     access::required("view", $item);
     $p = $request->params;
     if (isset($p->random)) {
         $orm = item::random_query()->offset(0)->limit(1);
     } else {
         $orm = ORM::factory("item")->viewable();
     }
     if (empty($p->scope)) {
         $p->scope = "direct";
     }
     if (!in_array($p->scope, array("direct", "all"))) {
         throw new Rest_Exception("Bad Request", 400);
     }
     if ($p->scope == "direct") {
         $orm->where("parent_id", "=", $item->id);
     } else {
         $orm->where("left_ptr", ">", $item->left_ptr);
         $orm->where("right_ptr", "<", $item->right_ptr);
     }
     if (isset($p->name)) {
         $orm->where("name", "LIKE", "%{$p->name}%");
     }
     if (isset($p->type)) {
         $orm->where("type", "IN", explode(",", $p->type));
     }
     $members = array();
     foreach ($orm->find_all() as $child) {
         $members[] = rest::url("item", $child);
     }
     return array("url" => $request->url, "entity" => $item->as_array(), "members" => $members, "relationships" => rest::relationships("item", $item));
 }
开发者ID:joericochuyt,项目名称:gallery3,代码行数:52,代码来源:item_rest.php


示例18: get_test

 public function get_test()
 {
     $t1 = tag::add(item::root(), "t1");
     $t2 = tag::add(item::root(), "t2");
     $request = new stdClass();
     $this->assert_equal_array(array("url" => rest::url("tags"), "members" => array(rest::url("tag", $t1), rest::url("tag", $t2))), tags_rest::get($request));
 }
开发者ID:assad2012,项目名称:gallery3-appfog,代码行数:7,代码来源:Tags_Rest_Helper_Test.php


示例19: get

 static function get($block_id, $theme)
 {
     if (identity::active_user()->guest) {
         return;
     }
     $block = "";
     switch ($block_id) {
         case "untagged_photo":
             $attempts = 0;
             do {
                 $item = item::random_query()->join("items_tags", "items.id", "items_tags.item_id", "left")->where("items.type", "!=", "album")->where("items_tags.item_id", "IS", null)->find_all(1)->current();
             } while (!$item && $attempts++ < 3);
             if ($item && $item->loaded()) {
                 $block = new Block();
                 $block->css_id = "g-tag-it-block";
                 $block->title = t("Tag it");
                 $block->content = new View("tag_it_block.html");
                 $block->content->item = $item;
                 $form = new Forge("tags/create/{$item->id}", "", "post", array("id" => "g-tag-it-add-tag-form", "class" => "g-short-form"));
                 $label = $item->is_album() ? t("Add tag to album") : ($item->is_photo() ? t("Add tag to photo") : t("Add tag to movie"));
                 $group = $form->group("add_tag")->label("Add Tag");
                 $group->input("name")->label($label)->rules("required")->id("name");
                 $group->hidden("item_id")->value($item->id);
                 $group->submit("")->value(t("Add Tag"));
                 $block->content->form = $form;
             }
             break;
     }
     return $block;
 }
开发者ID:webmatter,项目名称:gallery3-contrib,代码行数:30,代码来源:tag_it_block.php


示例20: add_item

 public function add_item($item, $amount = 1)
 {
     $it = null;
     if ($it instanceof item) {
         $it = $item;
     } else {
         if (is_numeric($item)) {
             $it = item::load_one($item);
         } else {
             if (is_string($item)) {
                 $it = item::load_one($item, 'name');
             } else {
                 return false;
             }
         }
     }
     $iit = new inventory_item();
     $iit->item_id = $it->id;
     $iit->inventory_id = $this->id;
     $iit->amount = $amount;
     $iit->refine_level = 0;
     $iit->enchantment_id = null;
     $iit->save();
     return $iit;
 }
开发者ID:TorbenKoehn,项目名称:lok,代码行数:25,代码来源:inventory.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP jAcl2类代码示例发布时间:2022-05-23
下一篇:
PHP ipsRegistry类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap