コード例 #1
0
 public function printable_view()
 {
     echo "<h1>" . htmlentities($this->title, ENT_QUOTES) . "</h1>";
     echo "<div class=\"printing-sb-header\"><strong>Client:</strong> " . htmlentities($this->client, ENT_QUOTES) . "<br> <strong>Date Begun:</strong> " . htmlentities($this->creationDate, ENT_QUOTES) . " <br> <strong>Date Due:</strong> " . htmlentities($this->dueDate, ENT_QUOTES) . "</div>";
     // Scene Printing Loop
     $counter = 1;
     if ($this->scenes != '') {
         $counter = count($this->scenes);
     }
     for ($i = 0; $i < $counter; $i++) {
         $sceneInfo = $this->scenes[$i];
         $currScene = new Scene($sceneInfo);
         $currScene->printable_version($i + 1);
     }
 }
コード例 #2
0
 public function label()
 {
     $charactor = Charactor::all();
     $scene = Scene::all();
     $object = Object::all();
     // dd('man');
     $price = Price::all();
     return Response::json(array('errCode' => 0, 'message' => '返回标签', '_char' => $charactor, 'scene' => $scene, 'object' => $object, 'price' => $price));
 }
コード例 #3
0
 public function label()
 {
     $charactor = Charactor::all();
     $scene = Scene::all();
     $object = Object::all();
     // dd('man');
     $price = Price::all();
     return View::make('pc.search')->with(array('errCode' => 0, 'message' => '返回标签', '_char' => $charactor, 'scene' => $scene, 'object' => $object, 'price' => $price));
 }
コード例 #4
0
ファイル: CoolShowFactory.class.php プロジェクト: vvcumt/zk
 static function getCoolShow($nCoolType)
 {
     $coolshow = null;
     switch ($nCoolType) {
         case COOLXIU_TYPE_THEMES:
         case COOLXIU_TYPE_THEMES_CONTACT:
         case COOLXIU_TYPE_THEMES_MMS:
         case COOLXIU_TYPE_THEMES_ICON:
             $coolshow = new Theme($nCoolType);
             break;
         case COOLXIU_TYPE_WALLPAPER:
         case COOLXIU_TYPE_ANDROIDESK_WALLPAPER:
         case COOLXIU_TYPE_SCENE_WALLPAPER:
             $coolshow = new Wallpaper();
             break;
         case COOLXIU_TYPE_RING:
             $coolshow = new Ring();
             break;
         case COOLXIU_TYPE_FONT:
             $coolshow = new Font();
             break;
         case COOLXIU_TYPE_SCENE:
             $coolshow = new Scene();
             break;
         case COOLXIU_TYPE_WIDGET:
             $coolshow = new Widget();
             break;
         case COOLXIU_TYPE_ALBUMS:
             $coolshow = new Albums();
             break;
         case COOLXIU_TYPE_LIVE_WALLPAPER:
             //动态壁纸资源为锁屏的一部分
             $coolshow = new Scene();
             $coolshow->setType('livewallpapers');
             break;
         case COOLXIU_TYPE_ALARM:
             $coolshow = new Alarm();
             break;
         default:
             $coolshow = new Theme();
             break;
     }
     return $coolshow;
 }
コード例 #5
0
ファイル: Scene.php プロジェクト: Bruno-2M/prestashop
 public function __construct($id = NULL, $id_lang = NULL, $liteResult = true, $hideScenePosition = false)
 {
     parent::__construct(intval($id), intval($id_lang));
     if (!$liteResult) {
         $this->products = $this->getProducts(true, intval($id_lang), false);
     }
     if ($hideScenePosition) {
         $this->name = Scene::hideScenePosition($this->name);
     }
 }
コード例 #6
0
ファイル: Scene.php プロジェクト: greench/prestashop
 public function __construct($id = NULL, $id_lang = NULL, $liteResult = true, $hideScenePosition = false)
 {
     parent::__construct((int) $id, (int) $id_lang);
     if (!$liteResult) {
         $this->products = $this->getProducts(true, (int) $id_lang, false);
     }
     if ($hideScenePosition) {
         $this->name = Scene::hideScenePosition($this->name);
     }
     $this->image_dir = _PS_SCENE_IMG_DIR_;
 }
コード例 #7
0
ファイル: ScenesTableSeeder.php プロジェクト: Jv-Juven/gift
 public function run()
 {
     Scene::create(['scene_id' => 1, '_class' => '生日']);
     Scene::create(['scene_id' => 2, '_class' => '毕业']);
     Scene::create(['scene_id' => 3, '_class' => '教师节']);
     Scene::create(['scene_id' => 4, '_class' => '母亲节']);
     Scene::create(['scene_id' => 5, '_class' => '求婚']);
     Scene::create(['scene_id' => 6, '_class' => '父情节']);
     Scene::create(['scene_id' => 7, '_class' => '圣诞节']);
     Scene::create(['scene_id' => 8, '_class' => '乔迁']);
     Scene::create(['scene_id' => 9, '_class' => '新年']);
     Scene::create(['scene_id' => 10, '_class' => '乔迁']);
     Scene::create(['scene_id' => 11, '_class' => '新年']);
 }
コード例 #8
0
 public function process()
 {
     parent::process();
     if (!($id_category = (int) Tools::getValue('id_category')) or !Validate::isUnsignedId($id_category)) {
         $this->errors[] = Tools::displayError('Missing category ID');
     } else {
         if (!Validate::isLoadedObject($this->category)) {
             $this->errors[] = Tools::displayError('Category does not exist');
         } elseif (!$this->category->checkAccess((int) self::$cookie->id_customer)) {
             $this->errors[] = Tools::displayError('You do not have access to this category.');
         } elseif (!$this->category->active) {
             self::$smarty->assign('category', $this->category);
         } else {
             $rewrited_url = self::$link->getCategoryLink((int) $this->category->id, $this->category->link_rewrite);
             /* Scenes  (could be externalised to another controler if you need them */
             self::$smarty->assign('scenes', Scene::getScenes((int) $this->category->id, (int) self::$cookie->id_lang, true, false));
             /* Scenes images formats */
             if ($sceneImageTypes = ImageType::getImagesTypes('scenes')) {
                 foreach ($sceneImageTypes as $sceneImageType) {
                     if ($sceneImageType['name'] == 'thumb_scene') {
                         $thumbSceneImageType = $sceneImageType;
                     } elseif ($sceneImageType['name'] == 'large_scene') {
                         $largeSceneImageType = $sceneImageType;
                     }
                 }
                 self::$smarty->assign('thumbSceneImageType', isset($thumbSceneImageType) ? $thumbSceneImageType : NULL);
                 self::$smarty->assign('largeSceneImageType', isset($largeSceneImageType) ? $largeSceneImageType : NULL);
             }
             $this->category->description = nl2br2($this->category->description);
             $subCategories = $this->category->getSubCategories((int) self::$cookie->id_lang);
             self::$smarty->assign('category', $this->category);
             if (isset($subCategories) and !empty($subCategories) and $subCategories) {
                 self::$smarty->assign('subcategories', $subCategories);
                 self::$smarty->assign(array('subcategories_nb_total' => sizeof($subCategories), 'subcategories_nb_half' => ceil(sizeof($subCategories) / 2)));
             }
             if ($this->category->id != 1) {
                 $this->productListAssign();
             }
             self::$smarty->assign(array('products' => (isset($this->cat_products) and $this->cat_products) ? $this->cat_products : NULL, 'id_category' => (int) $this->category->id, 'id_category_parent' => (int) $this->category->id_parent, 'return_category_name' => Tools::safeOutput($this->category->name), 'path' => Tools::getPath((int) $this->category->id), 'add_prod_display' => Configuration::get('PS_ATTRIBUTE_CATEGORY_DISPLAY'), 'categorySize' => Image::getSize('category'), 'mediumSize' => Image::getSize('medium'), 'thumbSceneSize' => Image::getSize('thumb_scene'), 'homeSize' => Image::getSize('home')));
             if (isset(self::$cookie->id_customer)) {
                 self::$smarty->assign('compareProducts', CompareProduct::getCustomerCompareProducts((int) self::$cookie->id_customer));
             } elseif (isset(self::$cookie->id_guest)) {
                 self::$smarty->assign('compareProducts', CompareProduct::getGuestCompareProducts((int) self::$cookie->id_guest));
             }
         }
     }
     self::$smarty->assign(array('allow_oosp' => (int) Configuration::get('PS_ORDER_OUT_OF_STOCK'), 'comparator_max_item' => (int) Configuration::get('PS_COMPARATOR_MAX_ITEM'), 'suppliers' => Supplier::getSuppliers()));
 }
コード例 #9
0
 function &sphereScene($level, &$center, $radius)
 {
     $sphere = new Sphere($center, $radius);
     if ($level == 1) {
         return $sphere;
     } else {
         $scene = new Group(new Sphere($center, 3.0 * $radius));
         $scene->add($sphere);
         $rn = 3.0 * $radius / sqrt(12.0);
         for ($dz = -1; $dz <= 1; $dz += 2) {
             for ($dx = -1; $dx <= 1; $dx += 2) {
                 $c2 = newVector($center[0] - $dx * $rn, $center[1] + $rn, $center[2] - $dz * $rn);
                 $scene->add(Scene::sphereScene($level - 1, $c2, $radius / 2.0));
             }
         }
         return $scene;
     }
 }
コード例 #10
0
ファイル: RayTracer.php プロジェクト: edin/raytracer
 public function render(Scene $scene, Image $image, $w, $h)
 {
     $camera = $scene->camera();
     $camPos = $camera->pos;
     for ($y = 0; $y < $h; ++$y) {
         for ($x = 0; $x < $w; ++$x) {
             $ray = new Ray($camPos, self::getPoint($x, $y, $camera, $w, $h));
             $color = Color::toDrawingColor($this->traceRay($ray, $scene, 0));
             $image->setPixel($x, $y, $color);
         }
     }
 }
コード例 #11
0
ファイル: _form.php プロジェクト: chrisjongo/lights-control
?>
    </div>

    <div class="row"> 
        <?php 
echo $form->checkBoxListInlineRow($model, 'tbl_schedule_recurring', array('Sun' => 'Sun', 'Mon' => 'Mon', 'Tue' => 'Tue', 'Wed' => 'Wed', 'Thu' => 'Thu', 'Fri' => 'Fri', 'Sat' => 'Sat'));
?>
    </div>

    <div class="row">
        <?php 
echo $form->labelEx($model, 'tbl_scenes_idtbl_scene');
?>
        
        <?php 
$models = Scene::model()->findAll(array('order' => 'tbl_scene_title'));
$list = CHtml::listData($models, 'idtbl_scene', 'tbl_scene_title');
echo CHtml::dropDownList('Scheduler[tbl_scenes_idtbl_scene]', $model->tbl_scenes_idtbl_scene, $list);
?>
        <?php 
echo $form->error($model, 'tbl_scenes_idtbl_scene');
?>
    </div>

    <div class="row buttons">
        <?php 
echo CHtml::submitButton($model->isNewRecord ? 'Create' : 'Save');
?>
    </div>

    <?php 
コード例 #12
0
    public function initFieldsForm()
    {
        $obj = $this->loadObject(true);
        $scene_image_types = ImageType::getImagesTypes('scenes');
        $large_scene_image_type = null;
        $thumb_scene_image_type = null;
        foreach ($scene_image_types as $scene_image_type) {
            if ($scene_image_type['name'] == 'scene_default') {
                $large_scene_image_type = $scene_image_type;
            }
            if ($scene_image_type['name'] == 'm_scene_default') {
                $thumb_scene_image_type = $scene_image_type;
            }
        }
        $fields_form = array('legend' => array('title' => $this->l('Image Maps'), 'image' => '../img/admin/photo.gif'), 'submit' => array('title' => $this->l('Save'), 'class' => 'button'), 'input' => array(array('type' => 'description', 'name' => 'description', 'label' => $this->l('How to map products in the image:'), 'text' => $this->l('When a customer hovers over the image with the mouse, a pop-up appears displaying a brief description of the product.') . $this->l('The customer can then click to open the product\'s full product page.') . $this->l('To achieve this, please define the \'mapping zone\' that, when hovered over, will display the pop-up.') . $this->l('Left-click with your mouse to draw the four-sided mapping zone, then release.') . $this->l('Then, begin typing the name of the associated product. A list of products appears.') . $this->l('Click the appropriate product, then click OK. Repeat these steps for each mapping zone you wish to create.') . $this->l('When you have finished mapping zones, click Save Image Map.')), array('type' => 'text', 'label' => $this->l('Image map name:'), 'name' => 'name', 'lang' => true, 'size' => 48, 'required' => true, 'hint' => $this->l('Invalid characters:') . ' <>;=#{}'), array('type' => 'radio', 'label' => $this->l('Status:'), 'name' => 'active', 'required' => false, 'class' => 't', 'is_bool' => true, 'values' => array(array('id' => 'active_on', 'value' => 1, 'label' => $this->l('Enabled')), array('id' => 'active_off', 'value' => 0, 'label' => $this->l('Disabled'))))));
        $this->fields_form = $fields_form;
        $image_to_map_desc = '';
        $image_to_map_desc .= $this->l('Format:') . ' JPG, GIF, PNG. ' . $this->l('File size:') . ' ' . Tools::getMaxUploadSize() / 1024 . '' . $this->l('kB max.') . ' ' . sprintf($this->l('If larger than the image size setting, the image will be reduced to %1$d x %2$dpx (width x height).'), $large_scene_image_type['width'], $large_scene_image_type['height']) . $this->l('If smaller than the image size setting, a white background will be added in order to achieve the correct image size.') . '<br />' . $this->l('Note: To change image dimensions, please change the \'large_scene\' image type settings to the desired size (in Back Office > Preferences > Images).');
        if ($obj->id && file_exists(_PS_SCENE_IMG_DIR_ . $obj->id . '-scene_default.jpg')) {
            $this->addJqueryPlugin('autocomplete');
            $this->addJqueryPlugin('imgareaselect');
            $this->addJs(_PS_JS_DIR_ . 'admin-scene-cropping.js');
            $image_to_map_desc .= '<br /><img id="large_scene_image" style="clear:both;border:1px solid black;" alt="" src="' . _THEME_SCENE_DIR_ . $obj->id . '-scene_default.jpg" /><br />';
            $image_to_map_desc .= '
						<div id="ajax_choose_product" style="display:none; padding:6px; padding-top:2px; width:600px;">
							' . $this->l('Begin typing the first letters of the product name, then select the product from the drop-down list:') . '
								<br /><input type="text" value="" id="product_autocomplete_input" /> 
								<input type="button" class="button" value="' . $this->l('OK') . '" onclick="$(this).prev().search();" />
								<input type="button" class="button" value="' . $this->l('Delete') . '" onclick="undoEdit();" />
						</div>
				';
            if ($obj->id && file_exists(_PS_SCENE_IMG_DIR_ . 'thumbs/' . $obj->id . '-thumb_scene.jpg')) {
                $image_to_map_desc .= '<br/>
					<img id="large_scene_image" style="clear:both;border:1px solid black;" alt="" src="' . _THEME_SCENE_DIR_ . 'thumbs/' . $obj->id . '-m_scene_default.jpg" />
					<br />';
            }
            $img_alt_desc = '';
            $img_alt_desc .= $this->l('If you want to use a thumbnail other than one generated from simply reducing the mapped image, please upload it here.') . '<br />' . $this->l('Format:') . ' JPG, GIF, PNG. ' . $this->l('Filesize:') . ' ' . Tools::getMaxUploadSize() / 1024 . '' . $this->l('kB max.') . ' ' . sprintf($this->l('Automatically resized to %1$d x %2$dpx (width x height).'), $thumb_scene_image_type['width'], $thumb_scene_image_type['height']) . '.<br />' . $this->l('Note: To change image dimensions, please change the \'thumb_scene\' image type settings to the desired size (in Back Office > Preferences > Images).');
            $input_img_alt = array('type' => 'file', 'label' => $this->l('Alternative thumbnail:'), 'name' => 'thumb', 'desc' => $img_alt_desc);
            $selected_cat = array();
            if (Tools::isSubmit('categories')) {
                foreach (Tools::getValue('categories') as $row) {
                    $selected_cat[] = $row;
                }
            } else {
                if ($obj->id) {
                    foreach (Scene::getIndexedCategories($obj->id) as $row) {
                        $selected_cat[] = $row['id_category'];
                    }
                }
            }
            $root_category = Category::getRootCategory();
            if (!$root_category->id) {
                $root_category->id = 0;
                $root_category->name = $this->l('Root');
            }
            $root_category = array('id_category' => (int) $root_category->id, 'name' => $root_category->name);
            $trads = array('Root' => $root_category, 'selected' => $this->l('selected'), 'Check all' => $this->l('Check all'), 'Check All' => $this->l('Check All'), 'Uncheck All' => $this->l('Uncheck All'), 'Collapse All' => $this->l('Collapse All'), 'Expand All' => $this->l('Expand All'), 'search' => $this->l('Search a category'));
            $this->fields_form['input'][] = array('type' => 'categories', 'label' => $this->l('Categories:'), 'name' => 'categories', 'values' => array('trads' => $trads, 'selected_cat' => $selected_cat, 'input_name' => 'categories[]', 'use_radio' => false, 'use_search' => true, 'disabled_categories' => array(4), 'top_category' => Category::getTopCategory(), 'use_context' => true));
        } else {
            $image_to_map_desc .= '<br/><span class="bold">' . $this->l('Please add a picture to continue mapping the image.') . '</span><br/><br/>';
        }
        if (Shop::isFeatureActive()) {
            $this->fields_form['input'][] = array('type' => 'shop', 'label' => $this->l('Shop association:'), 'name' => 'checkBoxShopAsso');
        }
        $this->fields_form['input'][] = array('type' => 'file', 'label' => $this->l('Image to be mapped:'), 'name' => 'image', 'display_image' => true, 'desc' => $image_to_map_desc);
        if (isset($input_img_alt)) {
            $this->fields_form['input'][] = $input_img_alt;
        }
    }
コード例 #13
0
 private function HandleQueryResponse($sth)
 {
     $found = array();
     $scenelist = "";
     while ($obj = $sth->fetchObject()) {
         $scene = new Scene();
         $scene->SceneID = $obj->ID;
         $scene->Name = $obj->Name;
         $scene->Enabled = $obj->Enabled;
         $scene->MinPosition = Vector3::Parse($obj->MinPosition);
         $scene->MaxPosition = Vector3::Parse($obj->MaxPosition);
         $scene->Address = $obj->Address;
         $scene->LastUpdate = $obj->LastUpdate;
         if (!is_null($obj->ExtraData)) {
             $scene->ExtraData = $obj->ExtraData;
         } else {
             $scene->ExtraData = "{}";
         }
         $found[] = $scene->toOSD();
         $scenelist = $scenelist . $scene->Name . ",";
     }
     log_message('debug', 'returning ' . count($found) . ' results : ' . $scenelist);
     header("Content-Type: application/json", true);
     echo '{ "Success": true, "Scenes": [' . implode(',', $found) . '] }';
     exit;
 }
コード例 #14
0
ファイル: category.php プロジェクト: redb/prestashop
 include dirname(__FILE__) . '/header.php';
 include dirname(__FILE__) . '/product-sort.php';
 $errors = array();
 if (!isset($_GET['id_category']) or !Validate::isUnsignedId($_GET['id_category'])) {
     $errors[] = Tools::displayError('category ID is missing');
 } else {
     $category = new Category(intval(Tools::getValue('id_category')), intval($cookie->id_lang));
     if (!Validate::isLoadedObject($category)) {
         $errors[] = Tools::displayError('category does not exist');
     } elseif (!$category->checkAccess(intval($cookie->id_customer))) {
         $errors[] = Tools::displayError('you do not have access to this category');
     } else {
         /* rewrited url set */
         $rewrited_url = $link->getCategoryLink($category->id, $category->link_rewrite);
         /* Scenes  (could be externalised to another controler if you need them */
         $smarty->assign('scenes', Scene::getScenes(intval($category->id), intval($cookie->id_lang), true, false));
         /* Scenes images formats */
         if ($sceneImageTypes = ImageType::getImagesTypes('scenes')) {
             foreach ($sceneImageTypes as $sceneImageType) {
                 if ($sceneImageType['name'] == 'thumb_scene') {
                     $thumbSceneImageType = $sceneImageType;
                 } elseif ($sceneImageType['name'] == 'large_scene') {
                     $largeSceneImageType = $sceneImageType;
                 }
             }
             $smarty->assign('thumbSceneImageType', isset($thumbSceneImageType) ? $thumbSceneImageType : NULL);
             $smarty->assign('largeSceneImageType', isset($largeSceneImageType) ? $largeSceneImageType : NULL);
         }
         $category->name = Category::hideCategoryPosition($category->name);
         $category->description = nl2br2($category->description);
         $subCategories = $category->getSubCategories(intval($cookie->id_lang));
コード例 #15
0
 public function process()
 {
     parent::process();
     if (!($id_category = (int) Tools::getValue('id_category')) or !Validate::isUnsignedId($id_category)) {
         $this->errors[] = Tools::displayError('Missing category ID');
     } else {
         if (!Validate::isLoadedObject($this->category)) {
             $this->errors[] = Tools::displayError('Category does not exist');
         } elseif (!$this->category->checkAccess((int) self::$cookie->id_customer)) {
             $this->errors[] = Tools::displayError('You do not have access to this category.');
         } elseif (!$this->category->active) {
             self::$smarty->assign('category', $this->category);
         } else {
             $rewrited_url = self::$link->getCategoryLink((int) $this->category->id, $this->category->link_rewrite);
             /* Scenes  (could be externalised to another controler if you need them */
             self::$smarty->assign('scenes', Scene::getScenes((int) $this->category->id, (int) self::$cookie->id_lang, true, false));
             /* Scenes images formats */
             if ($sceneImageTypes = ImageType::getImagesTypes('scenes')) {
                 foreach ($sceneImageTypes as $sceneImageType) {
                     if ($sceneImageType['name'] == 'thumb_scene') {
                         $thumbSceneImageType = $sceneImageType;
                     } elseif ($sceneImageType['name'] == 'large_scene') {
                         $largeSceneImageType = $sceneImageType;
                     }
                 }
                 self::$smarty->assign('thumbSceneImageType', isset($thumbSceneImageType) ? $thumbSceneImageType : NULL);
                 self::$smarty->assign('largeSceneImageType', isset($largeSceneImageType) ? $largeSceneImageType : NULL);
             }
             $this->category->description = nl2br2($this->category->description);
             $subCategories = $this->category->getSubCategories((int) self::$cookie->id_lang);
             self::$smarty->assign('category', $this->category);
             if (Db::getInstance()->numRows()) {
                 self::$smarty->assign('subcategories', $subCategories);
                 self::$smarty->assign(array('subcategories_nb_total' => sizeof($subCategories), 'subcategories_nb_half' => ceil(sizeof($subCategories) / 2)));
             }
             if ($this->category->id != 1) {
                 $nbProducts = $this->category->getProducts(NULL, NULL, NULL, $this->orderBy, $this->orderWay, true);
                 $this->pagination((int) $nbProducts);
                 self::$smarty->assign('nb_products', (int) $nbProducts);
                 $cat_products = $this->category->getProducts((int) self::$cookie->id_lang, (int) $this->p, (int) $this->n, $this->orderBy, $this->orderWay);
                 if ($cat_products) {
                     foreach ($cat_products as $cat_product) {
                         $prod_features[$cat_product["id_product"]] = Product::getFrontFeaturesStatic(self::$cookie->id_lang, $cat_product['id_product']);
                         $aux_product = new Product($cat_product["id_product"], true, self::$cookie->id_lang);
                         $aux_attributesGroups = $aux_product->getAttributesGroups((int) self::$cookie->id_lang);
                         foreach ($aux_attributesGroups as $k => $row) {
                             $aux_combinations[$row['attribute_name']]['price'] = (double) $row['price'];
                         }
                         $prod_combinations[$cat_product["id_product"]] = $aux_combinations;
                         unset($aux_combinations);
                     }
                 }
             }
             if (isset($prod_features)) {
                 self::$smarty->assign('prod_features', $prod_features);
             }
             if (isset($prod_combinations)) {
                 self::$smarty->assign('prod_combinations', $prod_combinations);
             }
             self::$smarty->assign(array('products' => (isset($cat_products) and $cat_products) ? $cat_products : NULL, 'id_category' => (int) $this->category->id, 'id_category_parent' => (int) $this->category->id_parent, 'return_category_name' => Tools::safeOutput($this->category->name), 'path' => Tools::getPath((int) $this->category->id), 'add_prod_display' => Configuration::get('PS_ATTRIBUTE_CATEGORY_DISPLAY'), 'categorySize' => Image::getSize('category'), 'mediumSize' => Image::getSize('medium'), 'thumbSceneSize' => Image::getSize('thumb_scene'), 'homeSize' => Image::getSize('home')));
             foreach ($subCategories as $subCat) {
                 $secondLevelCats[$subCat["id_category"]] = $this->getSubCats($subCat["id_category"]);
             }
             if (isset($secondLevelCats)) {
                 self::$smarty->assign('secondLevelCats', $secondLevelCats);
             }
         }
     }
     self::$smarty->assign(array('allow_oosp' => (int) Configuration::get('PS_ORDER_OUT_OF_STOCK'), 'comparator_max_item' => (int) Configuration::get('PS_COMPARATOR_MAX_ITEM'), 'suppliers' => Supplier::getSuppliers()));
 }
コード例 #16
0
 public function Execute($db, $params)
 {
     $sql = "";
     if (isset($params["SceneID"]) && UUID::TryParse($params["SceneID"], $this->SceneID)) {
         log_message('debug', "GetScene by SceneID " . $params["SceneID"]);
         $sql = "SELECT ID, Name, Address, Enabled, ExtraData, LastUpdate,\n                    CONCAT('<', MinX, ',', MinY, ',', MinZ, '>') AS MinPosition,  \n                    CONCAT('<', MaxX, ',', MaxY, ',', MaxZ, '>') AS MaxPosition\n                    FROM Scenes WHERE ID='" . $this->SceneID . "'";
         if (isset($params["Enabled"]) && $params["Enabled"]) {
             $sql .= " AND Enabled=1";
         }
     } else {
         if (isset($params["Name"])) {
             log_message('debug', "GetScene by Name " . $params["Name"]);
             $sql = "SELECT ID, Name, Address, Enabled, ExtraData, LastUpdate,\n                    CONCAT('<', MinX, ',', MinY, ',', MinZ, '>') AS MinPosition,  \n                    CONCAT('<', MaxX, ',', MaxY, ',', MaxZ, '>') AS MaxPosition\n                    FROM Scenes WHERE Name='" . $params["Name"] . "'";
             if (isset($params["Enabled"]) && $params["Enabled"]) {
                 $sql .= " AND Enabled=1";
             }
         } else {
             if (isset($params["Position"]) && Vector3::TryParse($params["Position"], $this->Position)) {
                 if (isset($params["FindClosest"]) && $params["FindClosest"]) {
                     log_message('debug', "GetScene (closest) by position " . $this->Position);
                     $sql = "SELECT ID, Name, Address, Enabled, ExtraData, LastUpdate,\n                        CONCAT('<', MinX, ',', MinY, ',', MinZ, '>') AS MinPosition,  \n                        CONCAT('<', MaxX, ',', MaxY, ',', MaxZ, '>') AS MaxPosition,\n                        GLength(LineString(GeomFromText('POINT(" . $this->Position->X . " " . $this->Position->Y . ")'), Centroid(XYPlane)))\n                        AS dist FROM Scenes";
                     $sql .= " WHERE ExtraData NOT REGEXP :RegExp";
                     if (isset($params["Enabled"]) && $params["Enabled"]) {
                         $sql .= " AND Enabled=1";
                     }
                     $sql .= " ORDER BY dist LIMIT 1";
                 } else {
                     log_message('debug', "GetScene by position " . $this->Position);
                     $sql = "SELECT ID, Name, Address, Enabled, ExtraData, LastUpdate,\n                        CONCAT('<', MinX, ',', MinY, ',', MinZ, '>') AS MinPosition,  \n                        CONCAT('<', MaxX, ',', MaxY, ',', MaxZ, '>') AS MaxPosition\n                        FROM Scenes WHERE MBRContains(XYPlane, GeomFromText('POINT(" . $this->Position->X . " " . $this->Position->Y . ")'))";
                     if (isset($params["Enabled"]) && $params["Enabled"]) {
                         $sql .= " AND Enabled=1";
                     }
                     $sql .= " LIMIT 1";
                 }
             } else {
                 header("Content-Type: application/json", true);
                 echo '{ "Message": "Invalid parameters" }';
                 exit;
             }
         }
     }
     log_message('debug', "what {$sql}");
     $sth = $db->prepare($sql);
     if (isset($params["FindClosest"]) && $params["FindClosest"]) {
         $sth->bindValue(':RegExp', '.+\\"HyperGrid\\":true.+');
     }
     if ($sth->execute()) {
         if ($sth->rowCount() > 0) {
             $obj = $sth->fetchObject();
             $scene = new Scene();
             $scene->SceneID = $obj->ID;
             $scene->Name = $obj->Name;
             $scene->Enabled = $obj->Enabled;
             $scene->MinPosition = Vector3::Parse($obj->MinPosition);
             $scene->MaxPosition = Vector3::Parse($obj->MaxPosition);
             $scene->Address = $obj->Address;
             $scene->LastUpdate = $obj->LastUpdate;
             if (!is_null($obj->ExtraData)) {
                 $scene->ExtraData = $obj->ExtraData;
             } else {
                 $scene->ExtraData = "{}";
             }
             $out = $scene->toOSD();
             $out = substr($out, 0, -1);
             $out .= ',"Success":true}';
             log_message('debug', "Found scene " . $scene->Name);
             header("Content-Type: application/json", true);
             echo $out;
             exit;
         } else {
             header("Content-Type: application/json", true);
             echo '{ "Message": "No matching scene found" }';
             exit;
         }
     } else {
         log_message('error', sprintf("Error occurred during query: %d %s", $sth->errorCode(), print_r($sth->errorInfo(), true)));
         log_message('debug', sprintf("Query: %s", $sql));
         header("Content-Type: application/json", true);
         echo '{ "Message": "Database query error" }';
         exit;
     }
 }
コード例 #17
0
ファイル: hypergrid.php プロジェクト: ronfesta/simiangrid
function lookup_scene_by_position($position, $findClosest = false)
{
    $config =& get_config();
    $gridService = $config['grid_service'];
    $response = webservice_post($gridService, array('RequestMethod' => 'GetScene', 'Position' => $position, 'FindClosest' => $findClosest ? '1' : '0', 'Enabled' => '1'));
    if (!empty($response['Success'])) {
        return Scene::fromOSD($response);
    }
    return null;
}
コード例 #18
0
 /**
  * Assigns scenes template variables
  */
 protected function assignScenes()
 {
     // Scenes (could be externalised to another controller if you need them)
     $scenes = Scene::getScenes($this->category->id, $this->context->language->id, true, false);
     $this->context->smarty->assign('scenes', $scenes);
     // Scenes images formats
     if ($scenes && ($scene_image_types = ImageType::getImagesTypes('scenes'))) {
         foreach ($scene_image_types as $scene_image_type) {
             if ($scene_image_type['name'] == ImageType::getFormatedName('m_scene')) {
                 $thumb_scene_image_type = $scene_image_type;
             } elseif ($scene_image_type['name'] == ImageType::getFormatedName('scene')) {
                 $large_scene_image_type = $scene_image_type;
             }
         }
         $this->context->smarty->assign(array('thumbSceneImageType' => isset($thumb_scene_image_type) ? $thumb_scene_image_type : null, 'largeSceneImageType' => isset($large_scene_image_type) ? $large_scene_image_type : null));
     }
 }
コード例 #19
0
    public function initFieldsForm()
    {
        $obj = $this->loadObject(true);
        $scene_image_types = ImageType::getImagesTypes('scenes');
        $large_scene_image_type = null;
        $thumb_scene_image_type = null;
        foreach ($scene_image_types as $scene_image_type) {
            if ($scene_image_type['name'] == 'scene_default') {
                $large_scene_image_type = $scene_image_type;
            }
            if ($scene_image_type['name'] == 'm_scene_default') {
                $thumb_scene_image_type = $scene_image_type;
            }
        }
        $fields_form = array('legend' => array('title' => $this->l('Image Maps'), 'icon' => 'icon-picture'), 'description' => '
				<h4>' . $this->l('How to map products in the image:') . '</h4>
				<p>
					' . $this->l('When a customer hovers over the image, a pop-up appears displaying a brief description of the product.') . '
					' . $this->l('The customer can then click to open the full product page.') . '<br/>
					' . $this->l('To achieve this, please define the \'mapping zone\' that, when hovered over, will display the pop-up.') . '
					' . $this->l('Left click with your mouse to draw the four-sided mapping zone, then release.') . '<br/>
					' . $this->l('Then begin typing the name of the associated product, and  a list of products will appear.') . '
					' . $this->l('Click the appropriate product and then click OK. Repeat these steps for each mapping zone you wish to create.') . '<br/>
					' . $this->l('When you have finished mapping zones, click "Save Image Map."') . '
				</p>', 'input' => array(array('type' => 'text', 'label' => $this->l('Image map name'), 'name' => 'name', 'lang' => true, 'required' => true, 'hint' => $this->l('Invalid characters:') . ' <>;=#{}'), array('type' => 'switch', 'label' => $this->l('Status'), 'name' => 'active', 'required' => false, 'class' => 't', 'is_bool' => true, 'values' => array(array('id' => 'active_on', 'value' => 1, 'label' => $this->l('Enabled')), array('id' => 'active_off', 'value' => 0, 'label' => $this->l('Disabled'))))), 'submit' => array('title' => $this->l('Save')));
        $this->fields_form = $fields_form;
        $image_to_map_desc = '';
        $image_to_map_desc .= '<div class="help-block">' . $this->l('Format:') . ' JPG, GIF, PNG. ' . $this->l('File size:') . ' ' . Tools::getMaxUploadSize() / 1024 . '' . $this->l('Kb max.') . ' ' . sprintf($this->l('If an image is too large, it will be reduced to %1$d x %2$dpx (width x height).'), $large_scene_image_type['width'], $large_scene_image_type['height']) . $this->l('If an image is deemed too small, a white background will be added in order to achieve the correct image size.') . '<br />' . $this->l('Note: To change image dimensions, please change the \'large_scene\' image type settings to the desired size (in Back Office > Preferences > Images).') . '</div>';
        if ($obj->id && file_exists(_PS_SCENE_IMG_DIR_ . $obj->id . '-scene_default.jpg')) {
            $this->addJqueryPlugin('autocomplete');
            $this->addJqueryPlugin('imgareaselect');
            $this->addJs(_PS_JS_DIR_ . 'admin/scenes.js');
            $image_to_map_desc .= '<div class="panel panel-default"><span class="thumbnail row-margin-bottom"><img id="large_scene_image" alt="" src="' . _THEME_SCENE_DIR_ . $obj->id . '-scene_default.jpg?rand=' . (int) rand() . '" /></span>';
            $image_to_map_desc .= '
				<div id="ajax_choose_product" class="row" style="display:none;">
					<div class="col-lg-12">
					<p class="alert alert-info">' . $this->l('Begin typing the first few letters of the product name, then select the product you are looking for from the drop-down list:') . '
					</p>
					<div class="input-group row-margin-bottom">
						<span class="input-group-addon">
							<i class="icon-search"></i>
						</span>
						<input type="text" value="" id="product_autocomplete_input" />
					</div>
					<button type="button" class="btn btn-default" onclick="undoEdit();"><i class="icon-remove"></i>&nbsp;' . $this->l('Delete') . '</button>
					<button type="button" class="btn btn-default" onclick="$(this).prev().search();"><i class="icon-check-sign"></i>&nbsp;' . $this->l('Ok') . '</button>
					</div>
				</div>
				';
            if ($obj->id && file_exists(_PS_SCENE_IMG_DIR_ . 'thumbs/' . $obj->id . '-m_scene_default.jpg')) {
                $image_to_map_desc .= '</div><hr/><img class="thumbnail" id="large_scene_image" style="clear:both;border:1px solid black;" alt="" src="' . _THEME_SCENE_DIR_ . 'thumbs/' . $obj->id . '-m_scene_default.jpg?rand=' . (int) rand() . '" />';
            }
            $img_alt_desc = '';
            $img_alt_desc .= $this->l('If you want to use a thumbnail other than one generated from simply reducing the mapped image, please upload it here.') . '<br />' . $this->l('Format:') . ' JPG, GIF, PNG. ' . $this->l('File size:') . ' ' . Tools::getMaxUploadSize() / 1024 . '' . $this->l('Kb max.') . ' ' . sprintf($this->l('Automatically resized to %1$d x %2$dpx (width x height).'), $thumb_scene_image_type['width'], $thumb_scene_image_type['height']) . '.<br />' . $this->l('Note: To change image dimensions, please change the \'m_scene_default\' image type settings to the desired size (in Back Office > Preferences > Images).');
            $input_img_alt = array('type' => 'file', 'label' => $this->l('Alternative thumbnail'), 'name' => 'thumb', 'desc' => $img_alt_desc);
            $selected_cat = array();
            if (Tools::isSubmit('categories')) {
                foreach (Tools::getValue('categories') as $row) {
                    $selected_cat[] = $row;
                }
            } elseif ($obj->id) {
                foreach (Scene::getIndexedCategories($obj->id) as $row) {
                    $selected_cat[] = $row['id_category'];
                }
            }
            $this->fields_form['input'][] = array('type' => 'categories', 'label' => $this->l('Categories'), 'name' => 'categories', 'tree' => array('id' => 'categories-tree', 'title' => 'Categories', 'selected_categories' => $selected_cat, 'use_search' => true, 'use_checkbox' => true));
        } else {
            $image_to_map_desc .= '<span>' . $this->l('Please add a picture to continue mapping the image.') . '</span>';
        }
        if (Shop::isFeatureActive()) {
            $this->fields_form['input'][] = array('type' => 'shop', 'label' => $this->l('Shop association'), 'name' => 'checkBoxShopAsso');
        }
        $this->fields_form['input'][] = array('type' => 'file', 'label' => $this->l('Image to be mapped'), 'name' => 'image', 'display_image' => true, 'desc' => $image_to_map_desc);
        if (isset($input_img_alt)) {
            $this->fields_form['input'][] = $input_img_alt;
        }
    }
コード例 #20
0
ファイル: SceneTest.php プロジェクト: rvilbrandt/gamebook
 /**
  * @covers rvilbrandt\gamebook\Model\Gamebook\Scene::setFromArray
  * @expectedException rvilbrandt\gamebook\Model\MissingAttributeException
  */
 public function testSetFromArrayIncompleteJson()
 {
     $this->object->setFromObject(json_decode(file_get_contents(__DIR__ . "/../../../data/object_incomplete.json")));
 }
コード例 #21
0
 public function testGetSceneNearVector()
 {
     $a = array('RequestMethod' => 'GetSceneNearVector', 'Vector' => '<256, 256, 75>');
     $r = new HttpRequest($this->server_url, HttpRequest::METH_POST);
     $r->addPostFields($a);
     $r->send();
     $this->assertEquals(200, $r->getResponseCode());
     $Scene5 = Scene::fromOSD($r->GetResponseBody());
     file_put_contents('scene5.dat', serialize($Scene5));
 }
コード例 #22
0
ファイル: homesliderpro.php プロジェクト: ac3gam3r/Maxokraft
 private function smartOverloARd()
 {
     //must be called in hookDisplayFooter to Work
     if (Tools::getValue('controller') == 'category') {
         $idCat = Tools::getValue('id_category');
         $scene = Scene::getScenes($idCat, $this->context->language->id, true, true);
         if ($scene) {
             //if there is a scene we stop we don't display the slider and let the scene show
             return;
         }
         $this->categorySlide = $this->getCategorySlide($idCat);
         //check if we have a slide for this category
         if ($this->categorySlide) {
             //we have a slide so let's remove the category image
             if ($this->hasActiveSlides($this->categorySlide)) {
                 //check if there is any active slide
                 $category = $this->context->smarty->getVariable('category');
                 $category = $category->value;
                 $category->id_image = 0;
             }
         }
     }
     if (Tools::getValue('controller') == 'cms' && Tools::getValue('id_cms') != '') {
         $cms = $this->context->smarty->getVariable('cms');
         //$this->context->smarty->clearAssign('cms');
         $cms = $cms->value;
         if (isset($cms->content) && !empty($cms->content)) {
             $cms->content = $this->doShortcode($cms->content);
             //$this->context->smarty->assign('cms', $cms);
         }
     }
     if (Tools::getValue('controller') == 'product' && Tools::getValue('id_product') != '') {
         $product = $this->context->smarty->getVariable('product');
         $product = $product->value;
         $this->product = $product;
         $product->description = $this->doShortcode($product->description);
     }
 }
コード例 #23
0
    public function displayForm($isMainTab = true)
    {
        global $currentIndex, $cookie;
        parent::displayForm();
        if (!($obj = $this->loadObject(true))) {
            return;
        }
        $langtags = 'name';
        $active = $this->getFieldValue($obj, 'active');
        echo '
		<script type="text/javascript">';
        echo 'startingData = new Array();' . "\n";
        foreach ($obj->getProducts() as $key => $product) {
            $productObj = new Product((int) $product['id_product'], true, (int) $cookie->id_lang);
            echo 'startingData[' . $key . '] = new Array(\'' . $productObj->name . '\', ' . $product['id_product'] . ', ' . $product['x_axis'] . ', ' . $product['y_axis'] . ', ' . $product['zone_width'] . ', ' . $product['zone_height'] . ');';
        }
        echo '</script>
		<form id="scenesForm" action="' . $currentIndex . '&submitAdd' . $this->table . '=1&token=' . $this->token . '" method="post" enctype="multipart/form-data">
		' . ($obj->id ? '<input type="hidden" name="id_' . $this->table . '" value="' . $obj->id . '" />' : '') . '
			<fieldset><legend><img src="../img/admin/photo.gif" />' . $this->l('Image Maps') . '</legend>';
        echo '
					<label>' . $this->l('How to map products in the image:') . ' </label>
					<div class="margin-form">
						' . $this->l('When a customer hovers over the image with the mouse, a pop-up appears displaying a brief description of the product. The customer can then click to open the product\'s full product page. To achieve this, please define the \'mapping zone\' that, when hovered over, will display the pop-up. Left-click with your mouse to draw the four-sided mapping zone, then release. Then, begin typing the name of the associated product. A list of products appears. Click the appropriate product, then click OK. Repeat these steps for each mapping zone you wish to create. When you have finished mapping zones, click Save Image Map.') . '
					</div>
					';
        echo '<label>' . $this->l('Image map name:') . ' </label>
				<div class="margin-form">';
        foreach ($this->_languages as $language) {
            echo '
					<div id="name_' . $language['id_lang'] . '" style="display: ' . ($language['id_lang'] == $this->_defaultFormLanguage ? 'block' : 'none') . '; float: left;">
						<input type="text" style="width: 260px" name="name_' . $language['id_lang'] . '" id="name_' . $language['id_lang'] . '" value="' . htmlentities($this->getFieldValue($obj, 'name', (int) $language['id_lang']), ENT_COMPAT, 'UTF-8') . '" /><sup> *</sup>
					</div>';
        }
        $this->displayFlags($this->_languages, $this->_defaultFormLanguage, $langtags, 'name');
        echo '		<div class="clear"></div>
				</div>';
        echo '<label>' . $this->l('Status:') . ' </label>
				<div class="margin-form">
					<input type="radio" name="active" id="active_on" value="1" ' . ((!$obj->id or Tools::getValue('active', $obj->active)) ? 'checked="checked" ' : '') . '/>
					<label class="t" for="active_on"> <img src="../img/admin/enabled.gif" alt="' . $this->l('Activated') . '" title="' . $this->l('Activated') . '" /></label>
					<input type="radio" name="active" id="active_off" value="0" ' . ((!Tools::getValue('active', $obj->active) and $obj->id) ? 'checked="checked" ' : '') . '/>
					<label class="t" for="active_off"> <img src="../img/admin/disabled.gif" alt="' . $this->l('Deactivated') . '" title="' . $this->l('Deactivated') . '" /></label>
					<p>' . $this->l('Activate or deactivate the image map') . '</p>
				</div>';
        $sceneImageTypes = ImageType::getImagesTypes('scenes');
        $largeSceneImageType = NULL;
        $thumbSceneImageType = NULL;
        foreach ($sceneImageTypes as $sceneImageType) {
            if ($sceneImageType['name'] == 'large_scene') {
                $largeSceneImageType = $sceneImageType;
            }
            if ($sceneImageType['name'] == 'thumb_scene') {
                $thumbSceneImageType = $sceneImageType;
            }
        }
        echo '<label>' . $this->l('Image to be mapped:') . ' </label>
				<div class="margin-form">
					<input type="hidden" id="stay_here" name="stay_here" value="" />
					<input type="file" name="image" id="image_input" /> <input type="button" value="' . $this->l('Upload image') . '" onclick="{$(\'#stay_here\').val(\'true\');$(\'#scenesForm\').submit();}" class="button" /><br/>
					<p>' . $this->l('Format:') . ' JPG, GIF, PNG. ' . $this->l('File size:') . ' ' . $this->maxImageSize / 1000 . '' . $this->l('KB max.') . ' ' . $this->l('If larger than the image size setting, the image will be reduced to ') . ' ' . $largeSceneImageType['width'] . 'x' . $largeSceneImageType['height'] . 'px ' . $this->l('(width x height). If smaller than the image-size setting, a white background will be added in order to achieve the correct image size.') . '.<br />' . $this->l('Note: To change image dimensions, please change the \'large_scene\' image type settings to the desired size (in Back Office > Preferences > Images).') . '</p>';
        if ($obj->id && file_exists(_PS_SCENE_IMG_DIR_ . $obj->id . '-large_scene.jpg')) {
            echo '<img id="large_scene_image" style="clear:both;border:1px solid black;" alt="" src="' . _THEME_SCENE_DIR_ . $obj->id . '-large_scene.jpg" /><br />';
            echo '
					<div id="ajax_choose_product" style="display:none; padding:6px; padding-top:2px; width:600px;">
						' . $this->l('Begin typing the first letters of the product name, then select the product from the drop-down list:') . '<br /><input type="text" value="" id="product_autocomplete_input" /> <input type="button" class="button" value="' . $this->l('OK') . '" onclick="$(this).prev().search();" /><input type="button" class="button" value="' . $this->l('Delete') . '" onclick="undoEdit();" />
					</div>
			';
            echo '
					<link rel="stylesheet" type="text/css" href="' . __PS_BASE_URI__ . 'css/jquery.autocomplete.css" />
					<link rel="stylesheet" type="text/css" href="' . __PS_BASE_URI__ . 'js/jquery/imgareaselect/imgareaselect-default.css" />
					<script type="text/javascript" src="' . __PS_BASE_URI__ . 'js/jquery/jquery.autocomplete.js"></script>
					<script type="text/javascript" src="' . __PS_BASE_URI__ . 'js/jquery/imgareaselect/jquery.imgareaselect.pack.js"></script>
					<script type="text/javascript" src="' . __PS_BASE_URI__ . 'js/admin-scene-cropping.js"></script>
		';
            echo '</div>';
            echo '<label>' . $this->l('Alternative thumbnail:') . ' </label>
				<div class="margin-form">
					<input type="file" name="thumb" id="thumb_input" />&nbsp;&nbsp;' . $this->l('(optional)') . '
					<p>' . $this->l('If you want to use a thumbnail other than one generated from simply reducing the mapped image, please upload it here.') . '<br />' . $this->l('Format:') . ' JPG, GIF, PNG. ' . $this->l('Filesize:') . ' ' . $this->maxImageSize / 1000 . '' . $this->l('Kb max.') . ' ' . $this->l('Automatically resized to') . ' ' . $thumbSceneImageType['width'] . 'x' . $thumbSceneImageType['height'] . 'px ' . $this->l('(width x height)') . '.<br />' . $this->l('Note: To change image dimensions, please change the \'thumb_scene\' image type settings to the desired size (in Back Office > Preferences > Images).') . '</p>
					';
            if ($obj->id && file_exists(_PS_SCENE_IMG_DIR_ . 'thumbs/' . $obj->id . '-thumb_scene.jpg')) {
                echo '<img id="large_scene_image" style="clear:both;border:1px solid black;" alt="" src="' . _THEME_SCENE_DIR_ . 'thumbs/' . $obj->id . '-thumb_scene.jpg" /><br />';
            }
            echo '</div>
			 ';
            echo '<label>' . $this->l('Category:') . ' </label>
				<div class="margin-form">
					<div style="overflow: auto; min-height: 300px; padding-top: 0.6em;" id="categoryList">
						<table cellspacing="0" cellpadding="0" class="table" style="width: 600px;">
								<tr>
									<th><input type="checkbox" name="checkme" class="noborder" onclick="checkDelBoxes(this.form, \'categoryBox[]\', this.checked)" /></th>
									<th>' . $this->l('ID') . '</th>
									<th>' . $this->l('Image map name:') . '</th>
								</tr>';
            $categories = Category::getCategories((int) $cookie->id_lang, false);
            $done = array();
            $index = array();
            if (Tools::isSubmit('categoryBox')) {
                foreach (Tools::getValue('categoryBox') as $k => $row) {
                    $index[] = $row;
                }
            } elseif ($obj->id) {
                foreach (Scene::getIndexedCategories($obj->id) as $k => $row) {
                    $index[] = $row['id_category'];
                }
            }
            $this->recurseCategoryForInclude($index, $categories, $categories[0][1], 1, null);
            echo '</table>
						<p style="padding:0px; margin:0px 0px 10px 0px;">' . $this->l('Mark all checkbox(es) of the categories for which the image map is to appear.') . '<sup> *</sup></p>
					</div>
				</div>';
            echo '
					<div id="save_scene" class="margin-form" ' . ($obj->id && file_exists(_PS_SCENE_IMG_DIR_ . $obj->id . '-large_scene.jpg') ? '' : 'style="display:none;"') . '>
						<input type="submit" value="' . $this->l('Save Image Map(s)') . '" class="button" />
					</div>';
        } else {
            echo '
					<br/><span class="bold">' . $this->l('Please add a picture to continue mapping the image...') . '</span><br/><br/>';
        }
        echo '<div class="small"><sup>*</sup> ' . $this->l('Required field') . '</div>
			</fieldset>
		</form>';
    }
コード例 #24
0
 /**
  * Returns the data model based on the primary key given in the GET variable.
  * If the data model is not found, an HTTP exception will be raised.
  * @param integer the ID of the model to be loaded
  */
 public function loadModel($id)
 {
     $model = Scene::model()->findByPk($id);
     if ($model === null) {
         throw new CHttpException(404, 'The requested page does not exist.');
     }
     return $model;
 }
コード例 #25
0
ファイル: Scene.php プロジェクト: jicheng17/pengwine
    /**
     * Get all products of this scene
     *
     * @return array Products
     */
    public function getProducts($only_active = true, $id_lang = null, $lite_result = true, Context $context = null)
    {
        if (!Scene::isFeatureActive()) {
            return array();
        }
        if (!$context) {
            $context = Context::getContext();
        }
        $id_lang = is_null($id_lang) ? $context->language->id : $id_lang;
        $products = Db::getInstance()->executeS('
		SELECT s.*
		FROM `' . _DB_PREFIX_ . 'scene_products` s
		LEFT JOIN `' . _DB_PREFIX_ . 'product` p ON (p.id_product = s.id_product)
		' . Shop::addSqlAssociation('product', 'p') . '
		WHERE s.id_scene = ' . (int) $this->id . ($only_active ? ' AND product_shop.active = 1' : ''));
        if (!$lite_result && $products) {
            foreach ($products as &$product) {
                $product['details'] = new Product($product['id_product'], !$lite_result, $id_lang);
                $product['link'] = $context->link->getProductLink($product['details']->id, $product['details']->link_rewrite, $product['details']->category, $product['details']->ean13);
                $cover = Product::getCover($product['details']->id);
                if (is_array($cover)) {
                    $product = array_merge($cover, $product);
                }
            }
        }
        return $products;
    }
コード例 #26
0
ファイル: scenes.php プロジェクト: bwssytems/domuslink
     break;
 case "edit":
     $tpl_edit = new Template(TPL_FILE_LOCATION . 'scenes_edit.tpl');
     $tpl_edit->set('lang', $lang);
     $tpl_edit->set('theScene', $settings[$_GET['line']]);
     $tpl_edit->set('floorplan', $floorPlan);
     $tpl_edit->set('selectedgroup', $groups->getAGroup($settings[$_GET['line']]->getAliasMap()->getGroup()));
     $tpl_edit->set('groups', $groupings);
     $tpl_edit->set('config', $config);
     $tpl_body->set('form', $tpl_edit);
     break;
 case "add":
     if (preg_match($chars, $_POST["label"])) {
         gen_error(null, $lang['error_special_chars']);
     } else {
         $aScene = new Scene();
         $aScene->setLabel(label_parse($_POST["label"], true));
         $aScene->setCommands($_POST["commands"]);
         $aScene->getAliasMap()->setType($lang["scene"]);
         $aScene->getAliasMap()->setAliasLabel(label_parse($_POST["label"], true));
         if (strlen(trim($_POST["newloc"])) > 0) {
             $aScene->getAliasMap()->setFloorPlanLabel(label_parse($_POST["newloc"], true));
         } else {
             $aScene->getAliasMap()->setFloorPlanLabel(label_parse($_POST["loc"], true));
         }
         $aScene->getAliasMap()->setHiddenFromHome("visible");
         $aScene->getAliasMap()->setGroup($_POST["group"]);
         $aScene->getAliasMap()->setAccessLevel(intval($_POST["secaccesslevel"]));
         $aScene->getAliasMap()->rebuildElementLine();
         $aScene->rebuildElementLine();
         $heyuconf->addElement($aScene);