Пример #1
0
 public function test_accessors()
 {
     /** === Test Data === */
     $NAME = 'name';
     $LEVEL = 'level';
     /** === Setup Mocks === */
     /** === Call and asserts  === */
     $this->obj->setName($NAME);
     $this->obj->setLevel($LEVEL);
     $this->assertEquals($NAME, $this->obj->getName());
     $this->assertEquals($LEVEL, $this->obj->getLevel());
 }
Пример #2
0
 public function testGetName()
 {
     $item = new Item('key', $this->storage);
     $this->assertEquals('key', $item->getName());
     $item = new Item('collection/item', $this->storage);
     $this->assertEquals('item', $item->getName());
 }
Пример #3
0
 function test_getName()
 {
     $name = "Gold Liberty Dollar";
     $test_Item = new Item(null, $name);
     $result = $test_Item->getName();
     $this->assertEquals($name, $result);
 }
Пример #4
0
 public function testSetGetName()
 {
     // Arrange
     $item = new Item();
     $item->setName('john');
     $expectedResult = 'john';
     // Act
     $result = $item->getName();
     // Assert
     $this->assertEquals($result, $expectedResult);
 }
Пример #5
0
 public function testNewItem()
 {
     $type = "test type";
     $name = "test name";
     $number = "test number";
     $quantity = "test quantity";
     $item = new Item($type, $name, $number, $quantity);
     $this->assertEquals($name, $item->getName());
     $this->assertEquals($number, $item->getNumber());
     $this->assertEquals($type, $item->getType());
     $this->assertEquals($quantity, $item->getQuantity());
 }
Пример #6
0
 function generate()
 {
     global $smarty;
     $this->toplist->generate();
     while ($row = $this->toplist->getRow()) {
         $item = new Item($row['itm_id']);
         $rows[] = array('rank' => false, 'name' => $item->getName(), 'uri' => edkURI::build(array('a', 'invtype', true), array('id', $item->getID(), true)), 'icon' => $item->getIcon(32), 'count' => $row['cnt']);
     }
     $smarty->assign('tl_name', Language::get('weapon'));
     $smarty->assign('tl_type', Language::get('kills'));
     $smarty->assignByRef('tl_rows', $rows);
     return $smarty->fetch(get_tpl('toplisttable'));
 }
Пример #7
0
 private function getItemData(Item $itemInformation)
 {
     $information = new Information();
     $information->set('name', $itemInformation->getName());
     $information->set('agi', $itemInformation->getAgility());
     $information->set('str', $itemInformation->getStrength());
     $information->set('int', $itemInformation->getIntelligence());
     $information->set('minDamage', $itemInformation->getDamage());
     $information->set('maxDamage', $itemInformation->getDamage());
     $information->set('hp', $itemInformation->getHp());
     $information->set('mana', $itemInformation->getMana());
     return $information;
 }
 /**
  *
  * @param Item $item
  * @return type
  * @throws DaoException 
  */
 public function updateItem(Item $item)
 {
     try {
         $query = Doctrine_Query::create()->update('Item i');
         $query->set('i.name', '?', $item->getName());
         $query->set('i.sales_unit_price', '?', $item->getSalesUnitPrice());
         $query->set('i.purchase_unit_price', '?', $item->getPurchaseUnitPrice());
         $query->set('i.description', '?', $item->getDescription());
         $query->set('i.stock_available', '?', $item->getStockAvailable());
         $query->where('i.id = ?', $item->getId());
         return $query->execute();
     } catch (Exception $e) {
         throw new DaoException($e->getMessage(), $e->getCode(), $e);
     }
 }
Пример #9
0
 public function insertItem(Item $item)
 {
     $con = self::openConnection();
     mysqli_begin_transaction($con);
     $code = $item->getCode();
     $name = $item->getName();
     $parent = $item->getParent() == null ? '' : $item->getParent()->getCode();
     $sql = "INSERT INTO category (code, name, parent_category_id) VALUE ('{$code}', '{$name}', '{$parent}')";
     mysqli_query($con, $sql);
     $affected = mysqli_affected_rows($con);
     if ($affected == 1) {
         mysqli_commit($con);
     } else {
         mysqli_rollback($con);
     }
     return $affected;
 }
 /**
  * @param Subcategory $subcategory
  * @param $name
  * @param $descr
  * @param $short_descr
  * @param $price
  * @param $stock
  * @return array
  * @throws Exception
  */
 public function create(Subcategory $subcategory, $name, $descr, $short_descr, $price, $stock)
 {
     $errors = array();
     $item = new Item($this->db);
     try {
         $item->setName($name);
         $item->setDescription($descr);
         $item->setShortDescription($short_descr);
         $item->setPrice($price);
         $item->setStock($stock);
     } catch (Exception $e) {
         $errors[] = $e->getMessage();
     }
     if (count($errors) == 0) {
         $name = $this->db->quote($item->getName());
         $description = $this->db->quote($item->getDescription());
         $shortDescription = $this->db->quote($item->getShortDescription());
         $price = $this->db->quote($item->getPrice());
         $stock = $this->db->quote($item->getStock());
         $query = "  INSERT INTO item(id_subcategory, name, descr, short_descr, price, stock)\n                               VALUES(" . $subcategory->getId() . ", " . $name . ", " . $description . ", " . $shortDescription . ", " . $price . ", " . $stock . ")";
         $data = $this->db->exec($query);
         if ($data) {
             $id = $this->db->lastInsertId();
             if ($id) {
                 try {
                     return $this->findById($id);
                 } catch (Exception $e) {
                     $errors[] = $e->getMessage();
                     return $errors;
                 }
             } else {
                 throw new Exception('Last insert error');
             }
         } else {
             throw new Exception('Db error');
         }
     } else {
         return $errors;
     }
 }
Пример #11
0
 function setTDPilotName($tdpilotname)
 {
     $npc = strpos($tdpilotname, "#");
     if ($npc === false) {
         $this->tdpilotname = $tdpilotname;
     } else {
         $name = explode("#", $tdpilotname);
         $plt = new Item($name[2]);
         $this->tdpilotname = $plt->getName();
     }
 }
Пример #12
0
                        </ul>
                    </div><br/>
                    <span>Total towards your cause: <span style="color:#2CBB76;font-weight:bold;text-decoration:underline;">$<?php 
echo $amt * 0.05;
?>
!</span></span>

                </div>
                <div class="col-lg-4" id="item_info">
                    <h3>Congratulations!</h3>
                    <img style="margin-right:1em;margin-bottom:1em;" width="200px" height="150px" src="<?php 
echo $product->getImage();
?>
" alt="profile_pic"/><br/>
                    <span><p>You Bought this <?php 
echo $product->getName();
?>
 for <span style="color:#2CBB76;font-weight:bold;text-decoration:underline;">$<?php 
echo $amt;
?>
!</span></p></span>
                    <span><p>5% is taken as a Service Charge - <span style="color:red;">$<?php 
echo $amt * 0.05;
?>
</span></p></span>
                </div>
                <div class="col-lg-4" id="seller_info">
                    <img style="margin-right:1em;margin-bottom:1em;" width="200px" height="250px" src="<?php 
echo $seller->getImage();
?>
" alt="profile_pic"/><br/>
Пример #13
0
// trieda aktualneho uzivatela
global $aktivny_sklad;
//trieda aktivne zvoleneho skladu
// stranka zobrazi sa len ked uzivatel JE prihlaseny, inak presmeruje na zakladny index.php
if (!is_registered()) {
    global $page;
    $page->redirect();
}
$vyrobok_id = $_REQUEST["vyrobok_id"];
$vyrobok = new Item();
//deklaracia tovaru
$vyrobok->loadItem($vyrobok_id);
//nahratie informacii z databazy o tovare
?>
<h1>Definovanie výrobku:<?php 
echo $vyrobok->getName();
?>
</h1>
<ul id="zoznam_skladov">
<?php 
//nacitame sklady na prepinac, prednastaveny bude aktivny sklad
$query = $database->select("SELECT * FROM sklad WHERE organizacia_id = '" . $uzivatel->getIdOrganizacie() . "'");
while ($vysl = $database->fetch_array($query)) {
    //prebehne vsetky nacitane sklady uzivatela
    //kontrola na aktualnost skladu
    if ($aktivny_sklad->getId() == $vysl["id"]) {
        // pri aktivnom sklade vypiseme len nazov
        echo "<li>" . $vysl["name"] . "</li>";
    } else {
        echo "<li><form><input type='submit' name='submit' value='" . $vysl["name"] . "' >\r\n                       <input type='hidden' name='sklad_id' value='" . $vysl["id"] . "' >\r\n                       <input type='hidden' name='vyrobok_id' value='" . $vyrobok->getId() . "' >    \r\n                       <input type='hidden' name='action' value='aktivuj_sklad' >    \r\n                       <input type='hidden' name='pageaction' value='definuj_vyrobok'>\r\n                 </form></li>";
    }
Пример #14
0
    public function update(Item $item)
    {
        $idCategory = $item->getCategory()->getId();
        $id = intval($id);
        $name = $this->db->quote($item->getName());
        $price = $this->db->quote($item->getPrice());
        $stock = $this->db->quote($item->getStock());
        $image = $this->db->quote($item->getImage());
        $description = $this->db->quote($item->getDescription());
        $query = '	UPDATE item
							SET name=' . $name . ',
								price=' . $price . ',
								stock=' . $stock . ',
								image=' . $image . ',
								description=' . $description . ',
								id_category=' . $idCategory . '
							WHERE id=' . $id;
        $res = $this->db->exec($query);
        if ($res) {
            $id = $this->db->lastInsertId();
            if ($id) {
                return $this->findByID($id);
            } else {
                throw new Exception('Internal server Error');
            }
        }
    }
function TestPilotName($fbpilotname)
{
    $npc = strpos($fbpilotname, "#");
    if ($npc === false) {
        $PilotName = $fbpilotname;
    } else {
        $name = explode("#", $fbpilotname);
        $plt = new Item($name[2]);
        $PilotName = $plt->getName();
    }
    return $PilotName;
}
Пример #16
0
 /**
  * @param \Math\StatIndex\Item $item
  */
 public function addItem(Item $item)
 {
     $this->_entries[$item->getName()] = $item;
 }
Пример #17
0
 /**
  * 
  * Returns true if this Item object represents the same actual repository item as the object $item.
  * @return boolean true if this Item object and $item represent the same actual repository item; false otherwise.
  * 
  */
 public function isSame(Item $item)
 {
     if ($this->path == $item->getPath() && $this->name == $item->getName()) {
         $isSame = true;
     } else {
         $isSame = false;
     }
     return $isSame;
 }