예제 #1
0
 /**
  * Add a button
  *
  * @param string $buttonId
  * @param array $data
  * @param integer $level
  * @param integer $sortOrder
  * @param string|null $region That button should be displayed in ('toolbar', 'header', 'footer', null)
  * @return void
  */
 public function add($buttonId, $data, $level = 0, $sortOrder = 0, $region = 'toolbar')
 {
     if (!isset($this->_buttons[$level])) {
         $this->_buttons[$level] = array();
     }
     $data['id'] = empty($data['id']) ? $buttonId : $data['id'];
     $data['button_key'] = $data['id'] . '_button';
     $data['region'] = empty($data['region']) ? $region : $data['region'];
     $data['level'] = $level;
     $sortOrder = $sortOrder ?: (count($this->_buttons[$level]) + 1) * 10;
     $data['sort_order'] = empty($data['sort_order']) ? $sortOrder : $data['sort_order'];
     $this->_buttons[$level][$buttonId] = $this->itemFactory->create(['data' => $data]);
 }
 private function selectcarte()
 {
     // récupération de plusieurs cartes possibles
     $cardFactory = new ItemFactory($this->oracle, $this->userlang);
     $card = $cardFactory->get_card(ItemFactory::CARD_NOT_ME);
     if (is_object($card) && get_class($card) == "Card") {
         //echo "<script>window.alert('C bon ça');</script>";
         $this->card = $card;
         $res = true;
     } else {
         array_push($this->errors, 'noCardBD');
         $_SESSION["notif"]["notification_error"]["Oracle"] = 'noCardBD';
         $res = false;
     }
     return $res;
 }
예제 #3
0
 /**
  * Process Parents by child
  *
  * @param int $productId
  * @param int $stockId
  * @param int $websiteId
  * @return $this
  */
 protected function _processParents($productId, $stockId = Stock::DEFAULT_STOCK_ID, $websiteId = null)
 {
     $parentIds = array();
     foreach ($this->getProductTypeInstances() as $typeInstance) {
         /* @var $typeInstance AbstractType */
         $parentIds = array_merge($parentIds, $typeInstance->getParentIdsByChild($productId));
     }
     if (!$parentIds) {
         return $this;
     }
     $productTypes = $this->getProductsType($parentIds);
     /** @var Item $item */
     $item = $this->_stockItemFactory->create();
     foreach ($parentIds as $parentId) {
         $parentType = isset($productTypes[$parentId]) ? $productTypes[$parentId] : null;
         $item->setData(array('stock_id' => $stockId))->setOrigData()->loadByProduct($parentId);
         $status = self::STATUS_IN_STOCK;
         $qty = 0;
         if ($item->getId()) {
             $status = $item->getIsInStock();
             $qty = $item->getQty();
         }
         $this->_processChildren($parentId, $parentType, $qty, $status, $item->getStockId(), $websiteId);
     }
     return $this;
 }
 public function testCreateFromXmlShouldCreateCompoundObject()
 {
     $xmlbuffer = "\n<xml>\n  <title>Adrian (Mich.)</title>\n  <subjec>Adrian High School (Adrian, Mich.); schools</subjec>\n  <descri>High School Building in Adrian (Mich.); c. 1920.</descri>\n  <format>Document</format>\n  <find>1608.cpd</find>\n</xml>\n    ";
     $item = ItemFactory::create_from_xml('p1234', '1608', NULL, $xmlbuffer);
     $this->assertEquals('Image', get_class($item));
     //image fetched from stubbed getItemInfo
 }
예제 #5
0
 public static function getInstance($filename)
 {
     if (is_null(self::$instance)) {
         //シングルトン
         self::$instance = new ItemFactory($filename);
     }
     return self::$instance;
 }
예제 #6
0
 public static function from_xml($alias, $itnum, $xmlbuffer, $parent = NULL)
 {
     $xml = new SimpleXMLElement($xmlbuffer);
     $doc = ItemFactory::node($xml, '//xml');
     $image = new Image($alias, $itnum, $parent);
     $image->title = (string) $doc->title;
     $image->file = (string) $doc->find;
     return $image;
 }
예제 #7
0
 public static function from_xml($alias, $itnum, $xmlbuffer, $parent = NULL)
 {
     $xml = new SimpleXMLElement($xmlbuffer);
     $doc = ItemFactory::node($xml, '//xml');
     $item = new Item($alias, $itnum, $parent);
     $item->title = (string) $doc->title;
     $item->file = (string) $doc->find;
     $item->description = (string) $doc->descri;
     $item->subject = (string) $doc->subjec;
     $item->creator = (string) $doc->creato;
     $item->type = (string) $doc->type;
     $item->date = (string) $doc->date;
     $item->format = (string) $doc->format;
     $item->set_xml($xmlbuffer);
     return $item;
 }
예제 #8
0
 public static function create_from_xml($alias, $itnum, $subitnum, $xmlbuffer)
 {
     $xml = new SimpleXMLElement($xmlbuffer);
     $xmlnode = ItemFactory::node($xml, '//xml');
     $format = (string) $xmlnode->format;
     $extension = Item::extension((string) $xmlnode->find);
     #some items have no format
     $is_image = array_search($extension, Item::image_extensions());
     if ($extension == 'cpd') {
         // $format == 'Document' ||  -- inconsistent
         $compound_object = CompoundObject::from_xml($alias, $itnum, $xmlbuffer);
         if ($subitnum != NULL) {
             return $compound_object->item_by_itnum($subitnum);
         } else {
             return $compound_object->first_item();
         }
     } else {
         if ($format == 'Image' || $is_image) {
             return Image::from_xml($alias, $itnum, $xmlbuffer);
         } else {
             return Item::from_xml($alias, $itnum, $xmlbuffer);
         }
     }
 }
예제 #9
0
    private function selectpartie()
    {
        try {
            //connexion à la BD
            $db = db::getInstance();
            //Dans le cas où le joueur souhaite arbitrer la carte après une partie en tant que devin
            if (isset($_SESSION["idCard"]) && isset($_SESSION["idEnregistrement"])) {
                $idCarte = $_SESSION["idCard"];
                $idEnregistrement = $_SESSION["idEnregistrement"];
                $sql = "SELECT * FROM `enregistrement` WHERE `enregistrementID` = {$idEnregistrement}";
                $db->query($sql);
                if ($db->num_rows() > 0) {
                    $this->raisin = $db->fetch_object();
                    //why why why ça et adresse ?
                    $this->enregistrement = "enregistrements/" . $this->raisin->cheminEnregistrement;
                    // récupération du pseudo du joueur arbitré
                    $sql = 'SELECT 
						username
						FROM user WHERE userid ="' . $this->raisin->idOracle . '"';
                    $this->result = $db->query($sql);
                    $this->res2 = mysqli_fetch_assoc($this->result);
                    $this->card = new Card($_SESSION["idCard"], './views/card.inline.display.php');
                    //construction de l'adresse de l'enregistrement à partir du nom du fichier
                    $this->adresse = "enregistrements/" . $this->raisin->cheminEnregistrement;
                    $this->partie = true;
                    unset($_SESSION["idCard"]);
                    unset($_SESSION["idEnregistrement"]);
                    return true;
                    //two returns
                } else {
                    array_push($this->errors, 'noEnregistrement');
                }
            } else {
                $this->partie = false;
                $recordingFactory = new ItemFactory($this->druid, $this->userlang);
                $this->raisin = $recordingFactory->get_recording(ItemFactory::LIMBO_RECORDING_ME_IF_POSSIBLE);
                if (is_object($this->raisin) && file_exists("enregistrements/" . $this->raisin->cheminEnregistrement)) {
                    //construction de l'adresse de l'enregistrement à partir du nom du fichier
                    $this->adresse = "enregistrements/" . $this->raisin->cheminEnregistrement;
                    $this->enregistrement = $this->raisin->enregistrementID;
                    // récupération du pseudo du joueur arbitré
                    $sql = 'SELECT username FROM user WHERE userid ="' . $this->raisin->idOracle . '"';
                    $this->result = $db->query($sql);
                    $this->res2 = mysqli_fetch_assoc($this->result);
                    //récupération de la carte jouée
                    $this->card = new Card($this->raisin->carteID, './views/card.inline.display.php');
                    $this->partie = true;
                } else {
                    //$this->partie reste faux
                    array_push($this->errors, 'noEnregistrement');
                }
            }
        } catch (Exception $e) {
            //$this->partie reste faux
            array_push($this->errors, 'noEnregistrement');
        }
        return $this->partie;
    }
예제 #10
0
 public static function from_xml($alias, $itnum, $xmlbuffer)
 {
     $xml = new SimpleXMLElement($xmlbuffer);
     $doc = ItemFactory::node($xml, '//xml');
     $compound_object = new CompoundObject($alias, $itnum);
     $compound_object->title = (string) $doc->title;
     $compound_object->file = (string) $doc->find;
     dmGetCompoundObjectInfo($alias, $itnum, $compound_xml_buffer);
     $compound_xml = new SimpleXMLElement($compound_xml_buffer);
     $type = $compound_xml->xpath('//cpd/type');
     if ((string) $type[0] == 'Monograph') {
         $pages = $compound_xml->xpath('//cpd/node/page');
     } else {
         $pages = $compound_xml->xpath('//cpd/page');
     }
     $num = 1;
     foreach ($pages as $page) {
         $subitnum = (string) $page->pageptr;
         $item = ItemFactory::create($alias, $subitnum, NULL);
         $compound_object->add_item($item, $num++);
     }
     return $compound_object;
 }
<? 
include("config.php");

$collection = Collection::from_alias($_GET['CISOROOT']);
$current_item = ItemFactory::create($_GET['CISOROOT'], $_GET['CISOPTR'],
                                    $_GET['CISOSHOW']);
$show_all = (isset($_GET["show_all"])) ? $_GET["show_all"] : false;

if(isset($_GET['search'])) {
  $search_status = new SearchStatus($_GET['search']);
}

$css_includes = array('screen/viewer');
if(get_class($current_item) == 'Image') {
  $js_includes = array('jquery-ui-1.7.1.custom.min', 
    'jquery.event.drag-1.5.min', 'dmmonocle.min',
    'compound_object_browser');
  $css_includes = array_merge($css_includes, array('dmmonocle','smoothness/jquery-ui-1.7.custom'));
}
define("FACEBOX",'display');

$breadcrumbs = array(
  'Home' => SEEKING_MICHIGAN_HOST,
  'Discover' => SEEKING_MICHIGAN_HOST.'/discover',
  'Collections' => SEEKING_MICHIGAN_HOST.'/discover',
  $collection->name => $collection->url(), 
  'Item Viewer' => '');

app()->partial('header', 
  array('body_class' => 'discover',
    'breadcrumbs' => $breadcrumbs, 
예제 #12
0
<?php

include "config.php";
$alias = isset($_GET["CISOROOT"]) ? $_GET["CISOROOT"] : 0;
$itnum = isset($_GET["CISOPTR"]) ? $_GET["CISOPTR"] : 0;
$current_item = ItemFactory::create($alias, $itnum);
// get the format of the image - 8in wide for protrait layout, 10.5in for landscape
if (get_class($current_item) == 'CompoundObject') {
    if ($current_item->is_overall_layout_portrait()) {
        $size = "8.5in 11in";
    } else {
        $size = "11in 8.5in";
    }
} elseif (get_class($current_item) == 'Image') {
    if ($current_item->is_portrait()) {
        $size = "8.5in 11in";
    } else {
        $size = "11in 8.5in";
    }
}
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
  <head>
    <script type="text/javascript" src="<?php 
echo SEEKING_MICHIGAN_HOST;
?>
/js/jquery.js"></script>
    <script type="text/javascript">
      $(window).load(function(){
        window.print();
예제 #13
0
    private function selectpartie()
    {
        $res = false;
        try {
            $recordingFactory = new ItemFactory($this->diviner, $this->userlang);
            $this->raisin = $recordingFactory->get_recording(ItemFactory::VALID_RECORDING_NOT_ME);
            if (is_object($this->raisin)) {
                // construction de l'adresse de l'enregistrement à  partir du nom du fichier son
                $this->adresse = "enregistrements/" . $this->raisin->cheminEnregistrement;
                //On vérifie ici que l'enregistrement est bien sur le serveur
                if (file_exists($this->adresse)) {
                    //récupération du contenu de la carte
                    $carte = new Card($this->raisin->carteID);
                    $this->card = $carte;
                    // récupération du pseudo de l'oracle pour savoir qui on écoute
                    $db = db::getInstance();
                    $sql = 'SELECT username
							FROM user WHERE userid ="' . $this->raisin->idOracle . '"';
                    if ($db->query($sql) && $db->num_rows() > 0) {
                        $this->res2 = $db->fetch_assoc();
                        //récupération du pseudo du créateur de la carte
                        $sql = 'SELECT username
							FROM user WHERE userid ="' . $this->card->get_author() . '"';
                        if ($db->query($sql) && $db->num_rows() > 0) {
                            $this->res4 = $db->fetch_assoc();
                            $res = true;
                        } else {
                            throw new Exception("Pas pu récupérer le nom de l'auteur '{$this->raisin}->idOracle'");
                        }
                    } else {
                        throw new Exception("Pas pu récupérer le nom de l'oracle '" . $this->card->get_author() . "'");
                    }
                }
            } else {
                array_push($this->errors, 'NoGame');
            }
        } catch (Exception $e) {
            array_push($this->errors, 'NoGame');
        }
        $this->setcarteValide($res);
        return $res;
    }