当前位置: 首页>>代码示例>>PHP>>正文


PHP Widget::create方法代码示例

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


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

示例1: initForUser

 public static function initForUser($id)
 {
     foreach (array('Salon', 'Cuisine', 'Chambre', 'Garage', 'Système') as $room) {
         $entity = new Dashboard();
         $entity->create();
         $entity->user = $id;
         $entity->label = $room;
         $entity->default = 0;
         $entity->save();
     }
     $entity = new Dashboard();
     $entity->create();
     $entity->user = $id;
     $entity->label = "Général";
     $entity->default = 1;
     $entity->save();
     $dashboard = $entity->id;
     $entity = new Widget();
     $entity->create();
     $entity->customQuery('INSERT INTO "yana_plugin_dashboard" ("model", "data", "cell", "column", "minified","dashboard") VALUES (\'dash_profil\',	\'null\',	\'0\',	\'0\',	\'\',\'' . $dashboard . '\');');
     $entity->customQuery('INSERT INTO "yana_plugin_dashboard" ("model", "data", "cell", "column", "minified","dashboard") VALUES (\'dash_monitoring_ram\',	\'null\',	\'0\',	\'1\',	\'\',\'' . $dashboard . '\');');
     $entity->customQuery('INSERT INTO "yana_plugin_dashboard" ("model", "data", "cell", "column", "minified","dashboard") VALUES (\'dash_monitoring_system\',	\'null\',	\'0\',	\'2\',	\'\',\'' . $dashboard . '\');');
     $entity->customQuery('INSERT INTO "yana_plugin_dashboard" ("model", "data", "cell", "column", "minified","dashboard") VALUES (\'dash_monitoring_network\',	\'null\',	\'0\',	\'2\',	\'\',\'' . $dashboard . '\');');
     $entity->customQuery('INSERT INTO "yana_plugin_dashboard" ("model", "data", "cell", "column", "minified","dashboard") VALUES (\'dash_monitoring_hdd\',	\'null\',	\'3\',	\'1\',	\'\',\'' . $dashboard . '\');');
     $entity->customQuery('INSERT INTO "yana_plugin_dashboard" ("model", "data", "cell", "column", "minified","dashboard") VALUES (\'dash_monitoring_disk\',	\'null\',	\'0\',	\'1\',	\'\',\'' . $dashboard . '\');');
     $entity->customQuery('INSERT INTO "yana_plugin_dashboard" ("model", "data", "cell", "column", "minified","dashboard") VALUES (\'dash_monitoring_gpio\',	\'null\',	\'1\',	\'0\',	\'\',\'' . $dashboard . '\');');
     $entity->customQuery('INSERT INTO "yana_plugin_dashboard" ("model", "data", "cell", "column", "minified","dashboard") VALUES (\'dash_monitoring_services\',	\'null\',	\'0\',	\'2\',	\'\',\'' . $dashboard . '\');');
     $entity->customQuery('INSERT INTO "yana_plugin_dashboard" ("model", "data", "cell", "column", "minified","dashboard") VALUES (\'dash_monitoring_users\',	\'null\',	\'0\',	\'0\',	\'\',\'' . $dashboard . '\');');
     $entity->customQuery('INSERT INTO "yana_plugin_dashboard" ("model", "data", "cell", "column", "minified","dashboard") VALUES (\'dash_monitoring_ram\',	\'null\',	\'0\',	\'1\',	\'\',\'' . $dashboard . '\');');
     $entity->customQuery('INSERT INTO "yana_plugin_dashboard" ("model", "data", "cell", "column", "minified","dashboard") VALUES (\'dash_monitoring_vocal\',	\'null\',	\'1\',	\'2\',	\'\',\'' . $dashboard . '\');');
     $entity->customQuery('INSERT INTO "yana_plugin_dashboard" ("model", "data", "cell", "column", "minified","dashboard") VALUES (\'dash_monitoring_logs\',	\'null\',	\'1\',	\'2\',	\'\',\'' . $dashboard . '\');');
     return $dashboard;
 }
开发者ID:rikimaruneo,项目名称:yana-server,代码行数:33,代码来源:Dashboard.class.php

示例2: redirect

if (!$session->isLogin) {
    redirect("../login.php");
}
$database = new Database();
$user = new User();
$widget = new Widget();
$menu = new Menu();
$post = new Post();
if (isset($_POST['widgetName'])) {
    $widgetId = $database->escapeString($_POST['widgetName']);
    $widgetName = "Widget " . $widgetId;
    $widget->setWidgetId($widgetId);
    $widget->setName($widgetName);
    $widget->setMenuId(0);
    $widget->setPostId(0);
    if ($widget->create($database)) {
        echo "true";
    } else {
        echo "false";
    }
} else {
    if (isset($_POST['widgetIds'])) {
        foreach ($_POST['widgetIds'] as $widgetId) {
            $widget->setWidgetId($widgetId);
            $widget->delete($database);
        }
        echo "true";
    } else {
        if (isset($_POST['widgetId'])) {
            $widgetId = $database->escapeString($_POST['widgetId']);
            $type = $database->escapeString($_POST['type']);
开发者ID:jetmirhaxhisefa,项目名称:rezervime,代码行数:31,代码来源:addAndDeleteWidget.php

示例3: Dashboard

<?php

global $myUser;
require_once 'Dashboard.class.php';
require_once 'Widget.class.php';
$entity = new Dashboard();
$entity->create();
$entity->user = $myUser->getId();
$entity->label = "Général";
$entity->default = 1;
$entity->save();
$dashboard = $entity->id;
$entity = new Widget();
$entity->create();
$s1 = new Section();
$s1->setLabel('dashboard');
$s1->save();
$r1 = new Right();
$r1->setSection($s1->getId());
$r1->setRead('1');
$r1->setDelete('1');
$r1->setCreate('1');
$r1->setUpdate('1');
$r1->setRank('1');
$r1->save();
$entity->customQuery('INSERT INTO "yana_plugin_dashboard" ("id", "model", "data", "cell", "column", "minified","dashboard") VALUES (1,	\'dash_profil\',	\'null\',	\'0\',	\'0\',	\'\',\'' . $dashboard . '\');');
$entity->customQuery('INSERT INTO "yana_plugin_dashboard" ("id", "model", "data", "cell", "column", "minified","dashboard") VALUES (2,	\'dash_monitoring_ram\',	\'null\',	\'0\',	\'1\',	\'\',\'' . $dashboard . '\');');
$entity->customQuery('INSERT INTO "yana_plugin_dashboard" ("id", "model", "data", "cell", "column", "minified","dashboard") VALUES (3,	\'dash_monitoring_system\',	\'null\',	\'0\',	\'2\',	\'\',\'' . $dashboard . '\');');
$entity->customQuery('INSERT INTO "yana_plugin_dashboard" ("id", "model", "data", "cell", "column", "minified","dashboard") VALUES (4,	\'dash_monitoring_network\',	\'null\',	\'0\',	\'2\',	\'\',\'' . $dashboard . '\');');
$entity->customQuery('INSERT INTO "yana_plugin_dashboard" ("id", "model", "data", "cell", "column", "minified","dashboard") VALUES (5,	\'dash_monitoring_hdd\',	\'null\',	\'3\',	\'1\',	\'\',\'' . $dashboard . '\');');
$entity->customQuery('INSERT INTO "yana_plugin_dashboard" ("id", "model", "data", "cell", "column", "minified","dashboard") VALUES (6,	\'dash_monitoring_disk\',	\'null\',	\'0\',	\'1\',	\'\',\'' . $dashboard . '\');');
开发者ID:thib3113,项目名称:yana-server,代码行数:31,代码来源:install.php


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