コード例 #1
0
ファイル: index.php プロジェクト: amitchouhan004/barchat
    function __construct($path)
    {
        $chanbar = '				<ul>
						<li id="settings" class="option"><a href="#" class="button">settings</a></li>
						<li id="files" class="option"><a href="#" class="button">files</a></li>
						<li id="people" class="option"><a href="#" class="button">people</a></li>
						</ul>
						';
        $user = Auth::user();
        $curchan = DB::get()->val('SELECT name from channels where user_id = :user_id AND active = 1', array('user_id' => $user->id));
        if ($curchan == '') {
            $curchan = 'bar';
        }
        $widgets = Widgets::get_widgets();
        $components = array('title' => 'Barchat Home', 'path' => $path, 'chanbar' => $chanbar, 'user_id' => Auth::user_id(), 'username' => $user->username, 'nickname' => $user->nickname, 'session_key' => $user->session_key, 'cur_chan' => addslashes($curchan), 'widgets' => $widgets);
        $v = new View($components);
        Plugin::call('reload', $user);
        //check for user agent
        $useragent = $_SERVER['HTTP_USER_AGENT'];
        //
        if (preg_match('/ip(hone|od|ad)/i', $useragent)) {
            $v->render('template-ios');
        } else {
            $v->render('template');
        }
    }
コード例 #2
0
ファイル: widget.php プロジェクト: Wildboard/WbWebApp
 public function action_index()
 {
     $this->before('oc-panel/pages/widgets/main');
     //template header
     $this->template->title = __('Widgets');
     Breadcrumbs::add(Breadcrumb::factory()->set_title(__('Widgets')));
     $this->template->scripts['footer'][] = 'js/jquery-sortable-min.js';
     $this->template->scripts['footer'][] = 'js/oc-panel/widgets.js';
     $this->template->widgets = Widgets::get_widgets();
     $this->template->placeholders = Widgets::get_placeholders();
 }
コード例 #3
0
ファイル: userSettings.php プロジェクト: precurse/netharbour
function displayDashboard()
{
    global $tool, $propertyForm;
    echo "<form method='post' action='' style='width:1024px;'>";
    echo "<table id=\"sortDataTable\" class='sortable' cellspacing=\"0\" cellpadding=\"0\" border=\"1\" style='width:100%; clear:left;'>\n\t\t<thead>\n\t\t<tr><th style='text-align:left;'>Dashboard widgets</th>\n\t\t\t<th style='text-align:left;'>Description</th>\n\t\t\t<th style='text-align:left;'>Version</th></tr>\n\t\t</thead>\n\t\t<tbody>";
    $widgets = Widgets::get_widgets();
    $curUser = new DashboardUsers($_SESSION['userid']);
    $userWidgets = $curUser->get_users_widgets();
    foreach ($widgets as $id => $value) {
        $curWidget = new Widgets($id);
        if ($curWidget->get_enabled()) {
            echo "<tr>";
            $enabled = false;
            foreach ($userWidgets as $widgetID => $userID) {
                if ($widgetID == $curWidget->get_id()) {
                    echo "<td><input type='checkbox' checked name='list[]' value='" . $curWidget->get_id() . "' />" . $curWidget->get_name() . "</td>";
                    $enabled = true;
                    break;
                }
            }
            if (!$enabled) {
                echo "<td><input type='checkbox' name='list[]' value='" . $curWidget->get_id() . "' />" . $curWidget->get_name() . "</td>";
            }
            echo "<td>" . $curWidget->get_description() . "</td>";
            echo "<td>" . $curWidget->get_version() . "</td>";
            echo "</tr>";
        } else {
            $curUser->set_widget_id($id);
            $curUser->remove_widget();
        }
    }
    echo "</tbody>\n\t</table>";
    echo "<input type='submit' name='saveDashboard' value='Save widget settings' style='float:left; clear:left; margin-bottom:5px;' />";
    echo "</form>";
}
コード例 #4
0
ファイル: core.php プロジェクト: amitchouhan004/barchat
 function ajax_widgets($path)
 {
     echo Widgets::get_widgets();
 }
コード例 #5
0
function updateDashboard()
{
    global $tool, $propertyForm;
    $enabledWidgets = $_POST['list'];
    //print_r($enabledWidgets);
    $curUser = new DashboardUsers($_SESSION['userid']);
    $widgets = Widgets::get_widgets();
    $update = true;
    foreach ($widgets as $id => $value) {
        $isEnabled = false;
        $curWidget = new Widgets($id);
        foreach ($enabledWidgets as $eID => $eValue) {
            if ($id == $eValue) {
                $curWidget->set_enabled(true);
                $isEnabled = true;
            }
        }
        if (!$isEnabled) {
            $curWidget->set_enabled(false);
            $curUser->set_widget_id($id);
            $curUser->remove_widget();
        }
        if ($curWidget->update_widget()) {
            $update = true;
        } else {
            $update = false;
            $error = $curWidget->get_error();
            break;
        }
    }
    if ($update) {
        $status = "success";
        echo "<script language='javascript'>LoadPage(\"configurations.php?action=dashWidgets&mode=edit&update=" . $status . "\", 'settingsInfo');</script>";
    } else {
        $propertyForm->error("Warning: Failed to enable widgets. Reason: " . $error);
    }
}