function _action()
{
    global $user, $db, $conf, $langs;
    $PDOdb = new TPDOdb();
    //$PDOdb->debug=true;
    $action = __get('action', 'list');
    switch ($action) {
        case 'list':
            _list($PDOdb, $db, $user, $conf, $langs);
            break;
        case 'listAvoir':
            _listAvoir($PDOdb, $db, $user, $conf, $langs);
            break;
        case 'create':
            _create($PDOdb, $db, $user, $conf, $langs);
            break;
        case 'createConfirm':
            _create_and_send($PDOdb, $db, $user, $conf, $langs);
            break;
        case 'createAvoir':
            _createAvoir($PDOdb, $db, $user, $conf, $langs);
            break;
        default:
            _list($PDOdb, $db, $user, $conf, $langs);
            break;
    }
}
Example #2
0
 /**
  * Render the specified file
  *
  * @param string $file must be a relative path, from PLUGINS_PATH
  */
 function osc_render_file($file = '') {
     if($file=='') {
         $file = __get('file');
     }
     // Clean $file to prevent hacking of some type
     osc_sanitize_url($file);
     $file = str_replace("../", "", str_replace("..\\", "", str_replace("://", "", preg_replace("|http([s]*)|", "", $file))));
     include osc_plugins_path().$file;
 }
Example #3
0
    function customHead() {
        $user = __get('user');

        if(isset($user['pk_i_id'])) {
            UserForm::js_validation_edit();
        } else {
            UserForm::js_validation();
        }?>
        <?php UserForm::location_javascript("admin"); ?>

        <?php
    }
Example #4
0
 public function set_portfolio($portfolio)
 {
     $portfolios = array();
     if (__isset("portfolios")) {
         $portfolios = __get("portfolios");
         array_push($portfolios, $portfolio);
         __set("portfolios", $portfolios);
     } else {
         __set("portfolios", array($portfolio));
     }
     __set("in_portfolio", true);
 }
function traite_get(&$PDOdb, $case)
{
    switch (strtolower($case)) {
        case 'autocomplete':
            __out(_autocomplete($PDOdb, GETPOST('fieldcode'), GETPOST('term'), GETPOST('fk_product'), GETPOST('type_product')));
            break;
        case 'autocomplete-serial':
            __out(_autocompleteSerial($PDOdb, GETPOST('lot_number'), GETPOST('fk_product')));
            break;
        case 'addofproduct':
            __out(_addofproduct($PDOdb, GETPOST('id_assetOf'), GETPOST('fk_product'), GETPOST('type'), GETPOST('default_qty_to_make', 'int') ? GETPOST('default_qty_to_make', 'int') : 1));
            break;
        case 'deletelineof':
            __out(_deletelineof($PDOdb, GETPOST('idLine'), GETPOST('type')), 'json');
            break;
        case 'addlines':
            __out(_addlines($PDOdb, GETPOST('idLine'), GETPOST('qty')), GETPOST('type'));
            break;
        case 'addofworkstation':
            __out(_addofworkstation($PDOdb, GETPOST('id_assetOf'), GETPOST('fk_asset_workstation')));
            break;
        case 'deleteofworkstation':
            __out(_deleteofworkstation($PDOdb, GETPOST('id_assetOf'), GETPOST('fk_asset_workstation_of')));
            break;
        case 'measuringunits':
            __out(_measuringUnits(GETPOST('type'), GETPOST('name')), 'json');
            break;
        case 'getofchildid':
            $Tid = array();
            $assetOf = new TAssetOF();
            $assetOf->load($PDOdb, __get('id', 0, 'integer'));
            $assetOf->getListeOFEnfants($PDOdb, $Tid);
            __out($Tid);
            break;
        case 'getchildlisthtml':
            $Tid = array();
            $assetOf = new TAssetOF();
            $assetOf->load($PDOdb, __get('id', 0, 'integer'));
            $assetOf->getListeOFEnfants($PDOdb, $Tid);
            echo _listOFEnfantHtml($PDOdb, $Tid);
            break;
        case 'getnomenclatures':
            __out(_getNomenclatures($PDOdb, GETPOST('fk_product')), 'json');
            break;
        case 'validernomenclature':
            __out(_validerNomenclature($PDOdb, GETPOST('id_assetOF'), GETPOST('fk_product'), GETPOST('fk_of_line'), GETPOST('fk_nomenclature'), GETPOST('qty')));
            break;
    }
}
Example #6
0
function customText($return = 'title')
{
    $new_item = __get('new_item');
    $text = array();
    if ($new_item) {
        $text['title'] = __('Listing');
        $text['subtitle'] = __('Add listing');
        $text['button'] = __('Add listing');
    } else {
        $text['title'] = __('Listing');
        $text['subtitle'] = __('Edit listing');
        $text['button'] = __('Update listing');
    }
    return $text[$return];
}
Example #7
0
function customFrmText()
{
    $rule = __get('rule');
    $return = array();
    if (isset($rule['pk_i_id'])) {
        $return['edit'] = true;
        $return['title'] = __('Edit rule');
        $return['action_frm'] = 'edit_ban_rule_post';
        $return['btn_text'] = __('Update rule');
    } else {
        $return['edit'] = false;
        $return['title'] = __('Add new ban rule');
        $return['action_frm'] = 'create_ban_rule_post';
        $return['btn_text'] = __('Add new ban rule');
    }
    return $return;
}
Example #8
0
function customFrmText($return = 'title')
{
    $page = __get('page');
    $text = array();
    if (isset($page['pk_i_id'])) {
        $text['edit'] = true;
        $text['title'] = __('Edit page');
        $text['action_frm'] = 'edit_post';
        $text['btn_text'] = __('Save changes');
    } else {
        $text['edit'] = false;
        $text['title'] = __('Add page');
        $text['action_frm'] = 'add_post';
        $text['btn_text'] = __('Add page');
    }
    return $text[$return];
}
Example #9
0
function customFrmText()
{
    $admin = __get("admin");
    $return = array();
    if (isset($admin['pk_i_id'])) {
        $return['admin_edit'] = true;
        $return['title'] = __('Edit admin');
        $return['action_frm'] = 'edit_post';
        $return['btn_text'] = __('Save');
    } else {
        $return['admin_edit'] = false;
        $return['title'] = __('Add admin');
        $return['action_frm'] = 'add_post';
        $return['btn_text'] = __('Add');
    }
    return $return;
}
Example #10
0
function customHead()
{
    $user = __get('user');
    ?>
        <script type="text/javascript" src="<?php 
    echo osc_current_admin_theme_js_url('jquery.validate.min.js');
    ?>
"></script>
        <?php 
    if (isset($user['pk_i_id'])) {
        UserForm::js_validation_edit();
    } else {
        UserForm::js_validation();
    }
    ?>
        <?php 
    UserForm::location_javascript("admin");
    ?>

        <?php 
}
Example #11
0
 * of the GNU Affero General Public License as published by the Free Software Foundation,
 * either version 3 of the License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
 * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 * See the GNU Affero General Public License for more details.
 *
 * You should have received a copy of the GNU Affero General Public
 * License along with this program. If not, see <http://www.gnu.org/licenses/>.
 */
$users = __get('users');
$stat = __get('stat');
$categories = __get('categories');
$countries = __get('countries');
$regions = __get('regions');
$cities = __get('cities');
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" dir="ltr" lang="<?php 
echo str_replace('_', '-', osc_current_user_locale());
?>
">
    <head>
        <?php 
osc_current_admin_theme_path('head.php');
?>
        <link href="<?php 
echo osc_current_admin_theme_styles_url('datatables.css');
?>
" rel="stylesheet" type="text/css" />
        <!-- datatables js -->
Example #12
0
</h1>
<?php 
}
osc_add_hook('admin_page_header', 'customPageHeader');
function customPageTitle($string)
{
    return sprintf(__('Edit language &raquo; %s'), $string);
}
osc_add_filter('admin_title', 'customPageTitle');
//customize Head
function customHead()
{
    LanguageForm::js_validation();
}
osc_add_hook('admin_header', 'customHead', 10);
$aLocale = __get('aLocale');
osc_current_admin_theme_path('parts/header.php');
?>
<h2 class="render-title"><?php 
_e('Edit language');
?>
</h2>
<div id="language-form">
    <ul id="error_list"></ul>
    <form name="language_form" action="<?php 
echo osc_admin_base_url(true);
?>
" method="post">
        <input type="hidden" name="page" value="languages" />
        <input type="hidden" name="action" value="edit_post" />
        <?php 
Example #13
0
 * OSClass – software for creating and publishing online classified advertising platforms
 *
 * Copyright (C) 2010 OSCLASS
 *
 * This program is free software: you can redistribute it and/or modify it under the terms
 * of the GNU Affero General Public License as published by the Free Software Foundation,
 * either version 3 of the License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
 * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 * See the GNU Affero General Public License for more details.
 *
 * You should have received a copy of the GNU Affero General Public
 * License along with this program. If not, see <http://www.gnu.org/licenses/>.
 */
$aCurrency = __get('aCurrency');
?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" dir="ltr" lang="en-US">
    <head>
        <?php 
osc_current_admin_theme_path('head.php');
?>
    </head>
    <body>
        <?php 
osc_current_admin_theme_path('header.php');
?>
        <div id="update_version" style="display:none;"></div>
		<div id="content">
Example #14
0
                        alert(data.html);
                    }, 'json');
                    return false;
                });
            });

        </script>
        <?php 
}
osc_add_hook('admin_header', 'customHead', 10);
function customPageTitle($string)
{
    return sprintf(__('Edit email template &raquo; %s'), $string);
}
osc_add_filter('admin_title', 'customPageTitle');
$email = __get("email");
$aEmailVars = EmailVariables::newInstance()->getVariables($email);
$locales = OSCLocale::newInstance()->listAllEnabled();
osc_current_admin_theme_path('parts/header.php');
?>

<div class="grid-row no-bottom-margin">
    <div class="row-wrapper">
        <h2 class="render-title"><?php 
_e('Edit email template');
?>
</h2>
    </div>
</div>
<div id="pretty-form">
    <div class="grid-row grid-100">
Example #15
0
function showingResults()
{
    $aData = __get("aData");
    echo '<ul class="showing-results"><li><span>' . osc_pagination_showing((Params::getParam('iPage') - 1) * $aData['iDisplayLength'] + 1, (Params::getParam('iPage') - 1) * $aData['iDisplayLength'] + count($aData['aRows']), $aData['iTotalDisplayRecords'], $aData['iTotalRecords']) . '</span></li></ul>';
}
Example #16
0
 * This program is free software: you can redistribute it and/or modify it under the terms
 * of the GNU Affero General Public License as published by the Free Software Foundation,
 * either version 3 of the License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
 * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 * See the GNU Affero General Public License for more details.
 *
 * You should have received a copy of the GNU Affero General Public
 * License along with this program. If not, see <http://www.gnu.org/licenses/>.
 */
$user = __get("user");
$countries = __get("countries");
$regions = __get("regions");
$cities = __get("cities");
$locales = __get("locales");
if (isset($user['pk_i_id'])) {
    // editing...
    $edit = true;
    $title = __("Edit");
    $action_frm = "edit_post";
    $btn_text = __("Update");
} else {
    // adding...
    $edit = false;
    $title = __("Add");
    $action_frm = "create_post";
    $btn_text = __('Add');
}
?>
Example #17
0
 *
 * Copyright (C) 2010 OSCLASS
 *
 * This program is free software: you can redistribute it and/or modify it under the terms
 * of the GNU Affero General Public License as published by the Free Software Foundation,
 * either version 3 of the License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
 * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 * See the GNU Affero General Public License for more details.
 *
 * You should have received a copy of the GNU Affero General Public
 * License along with this program. If not, see <http://www.gnu.org/licenses/>.
 */
$categories = __get("categories");
$parent = __get("parent");
$last = end($categories);
$last_id = $last['pk_i_id'];
?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" dir="ltr" lang="en-US">
    <head>
        <?php 
osc_current_admin_theme_path('head.php');
?>
        <script src="<?php 
echo osc_current_admin_theme_url('js/vtip/vtip.js');
?>
" type="text/javascript"></script>
        <link rel="stylesheet" type="text/css" media="all" href="<?php 
Example #18
0
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
osc_enqueue_script('jquery-validate');
//getting variables for this view
$themes = __get("themes");
$info = WebThemes::newInstance()->loadThemeInfo(osc_theme());
//customize Head
function customHead()
{
    ?>
        <script type="text/javascript">
            $(document).ready(function() {
                // dialog delete
                $("#dialog-delete-theme").dialog({
                    autoOpen: false,
                    modal: true,
                    title: '<?php 
    echo osc_esc_js(__('Delete theme'));
    ?>
'
Example #19
0
function customHead()
{
    $users = __get("users");
    $max = __get("max");
    $item = __get("item");
    $users_by_country = __get("users_by_country");
    $users_by_region = __get("users_by_region");
    $latest_users = __get("latest_users");
    ?>
    <script type="text/javascript" src="https://www.google.com/jsapi"></script>
    <?php 
    if (count($users) > 0) {
        ?>
    <script type="text/javascript">
        // Load the Visualization API and the piechart package.
        google.load('visualization', '1', {'packages':['corechart']});

        // Set a callback to run when the Google Visualization API is loaded.
        google.setOnLoadCallback(drawChart);

        // Callback that creates and populates a data table,
        // instantiates the pie chart, passes in the data and
        // draws it.
        function drawChart() {
            var data = new google.visualization.DataTable();

            data.addColumn('string', '<?php 
        echo osc_esc_js(__('Date'));
        ?>
',0,1);
            data.addColumn('number', '<?php 
        echo osc_esc_js(__('New users'));
        ?>
');
            <?php 
        $k = 0;
        echo "data.addRows(" . count($users) . ");";
        foreach ($users as $date => $num) {
            echo "data.setValue(" . $k . ', 0, "' . $date . '");';
            echo "data.setValue(" . $k . ", 1, " . $num . ");";
            $k++;
        }
        ?>

            // Instantiate and draw our chart, passing in some options.
            var chart = new google.visualization.AreaChart(document.getElementById('placeholder'));
            chart.draw(data, {
                    colors:['#058dc7','#e6f4fa'],
                        areaOpacity: 0.1,
                        lineWidth:3,
                        hAxis: {
                        gridlines:{
                            color: '#333',
                            count: 3
                        },
                        viewWindow:'explicit',
                        showTextEvery: 2,
                        slantedText: false,
                        textStyle:{
                            color: '#058dc7',
                            fontSize: 10
                        }
                        },
                        vAxis: {
                            gridlines:{
                                color: '#DDD',
                                count: 4,
                                style: 'dooted'
                            },
                            viewWindow:'explicit',
                            baselineColor:'#bababa'

                        },
                        pointSize: 6,
                        legend: 'none',
                        chartArea:{
                            left:10,
                            top:10,
                            width:"95%",
                            height:"80%"
                        }
                    });

            var data_country = new google.visualization.DataTable();
            data_country.addColumn('string', '<?php 
        _e('Country');
        ?>
');
            data_country.addColumn('number', '<?php 
        _e('Users per country');
        ?>
');
            data_country.addRows(<?php 
        echo count($users_by_country);
        ?>
);
            <?php 
        foreach ($users_by_country as $k => $v) {
            echo "data_country.setValue(" . $k . ", 0, '" . ($v['s_country'] == NULL ? __('Unknown') : $v['s_country']) . "');";
            echo "data_country.setValue(" . $k . ", 1, " . $v['num'] . ");";
        }
        ?>

            // Create and draw the visualization.
            new google.visualization.PieChart(document.getElementById('by_country')).draw(data_country, {title:null,height: 200});

            var data_region = new google.visualization.DataTable();
            data_region.addColumn('string', '<?php 
        _e('Region');
        ?>
');
            data_region.addColumn('number', '<?php 
        _e('Users per region');
        ?>
');
            data_region.addRows(<?php 
        echo count($users_by_region);
        ?>
);
            <?php 
        foreach ($users_by_region as $k => $v) {
            echo "data_region.setValue(" . $k . ", 0, '" . ($v['s_region'] == NULL ? __('Unknown') : $v['s_region']) . "');";
            echo "data_region.setValue(" . $k . ", 1, " . $v['num'] . ");";
        }
        ?>

            // Create and draw the visualization.
            new google.visualization.PieChart(document.getElementById('by_region')).draw(data_region, {title:null,height: 200});
        }
    </script>
<?php 
    }
}
Example #20
0
 * OSClass – software for creating and publishing online classified advertising platforms
 *
 * Copyright (C) 2010 OSCLASS
 *
 * This program is free software: you can redistribute it and/or modify it under the terms
 * of the GNU Affero General Public License as published by the Free Software Foundation,
 * either version 3 of the License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
 * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 * See the GNU Affero General Public License for more details.
 *
 * You should have received a copy of the GNU Affero General Public
 * License along with this program. If not, see <http://www.gnu.org/licenses/>.
 */
$page = __get('page');
$locales = OSCLocale::newInstance()->listAllEnabled();
if (isset($page['pk_i_id'])) {
    $edit = true;
    $title = __('Edit page');
    $action_frm = 'edit_post';
    $btn_text = osc_esc_html(__('Save changes'));
} else {
    $edit = false;
    $title = __('Add page');
    $action_frm = 'add_post';
    $btn_text = osc_esc_html(__('Add page'));
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" dir="ltr" lang="en-US">
Example #21
0
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
osc_enqueue_script('jquery-nested');
osc_enqueue_script('tabber');
$categories = __get('categories');
function addHelp()
{
    echo '<p>' . __('Add, edit or delete the categories or subcategories in which users can post listings. Reorder sections by dragging and dropping, or nest a subcategory in an expanded category. <strong>Be careful</strong>: If you delete a category, all listings associated will also be deleted!') . '</p>';
}
osc_add_hook('help_box', 'addHelp');
function customPageHeader()
{
    ?>
        <h1><?php 
    _e('Categories');
    ?>
            <a href="#" class="btn ico ico-32 ico-help float-right"></a>
            <a href="<?php 
    echo osc_admin_base_url(true);
    ?>
Example #22
0
				        <div id="content_header_arrow">&raquo; <?php 
_e('Plugins');
?>
</div>
				        <a href="<?php 
echo osc_admin_base_url(true);
?>
?page=plugins&action=add" id="button_open"><?php 
_e('Add a new plugin');
?>
</a>
				        <div style="clear: both;"></div>
			        </div>
			        <?php 
osc_show_flash_message('admin');
?>
			        <div id="content_separator"></div>
			        <div id="TableToolsToolbar"></div>
			        <div>
                        <?php 
require __get("file");
?>
                    </div>
		        </div> <!-- end of right column -->
            <div style="clear: both;"></div>
        </div> <!-- end of container -->
        <?php 
osc_current_admin_theme_path('footer.php');
?>
    </body>
</html>
Example #23
0
 *
 * Copyright (C) 2010 OSCLASS
 *
 * This program is free software: you can redistribute it and/or modify it under the terms
 * of the GNU Affero General Public License as published by the Free Software Foundation,
 * either version 3 of the License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
 * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 * See the GNU Affero General Public License for more details.
 *
 * You should have received a copy of the GNU Affero General Public
 * License along with this program. If not, see <http://www.gnu.org/licenses/>.
 */
$pages = __get("pages");
$prefLocale = __get("prefLocale");
$last = end($pages);
$last_id = $last['pk_i_id'];
?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" dir="ltr" lang="en-US">
    <head>
        <?php 
osc_current_admin_theme_path('head.php');
?>
    </head>
    <body>
        <?php 
osc_current_admin_theme_path('header.php');
?>
Example #24
0
 *
 * This program is free software: you can redistribute it and/or modify it under the terms
 * of the GNU Affero General Public License as published by the Free Software Foundation,
 * either version 3 of the License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
 * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 * See the GNU Affero General Public License for more details.
 *
 * You should have received a copy of the GNU Affero General Public
 * License along with this program. If not, see <http://www.gnu.org/licenses/>.
 */
osc_enqueue_script('jquery-treeview');
$fields = __get('fields');
$categories = __get('categories');
$selected = __get('default_selected');
function addHelp()
{
    echo '<p>' . __('Create new fields for users to fill out when they publish a listing. You can require extra  information such as the number of bedrooms in real estate listings or fuel type in car listings, for example.') . '</p>';
}
osc_add_hook('help_box', 'addHelp');
function customPageHeader()
{
    ?>
        <h1><?php 
    _e('Listing');
    ?>
            <a href="#" class="btn ico ico-32 ico-help float-right"></a>
            <a href="#" class="btn btn-green ico ico-32 ico-add-white float-right" id="add-button"><?php 
    _e('Add custom field');
    ?>
Example #25
0
function addHelp()
{
    echo '<p>' . __('Browse and download available Osclass plugins, from a constantly-updated selection. After downloading a plugin, you have to install it and configure it to get it up and running.') . '</p>';
}
osc_add_hook('help_box', 'addHelp');
osc_current_admin_theme_path('market/header.php');
$title = __get('title');
$section = __get('section');
$array = __get('array');
$pagination = __get('pagination');
$sort = __get('sort');
$url_premium = __get('url_premium');
$url_all = __get('url_all');
$aFeatured = __get('aFeatured');
$colors = array_merge(gradienColors(), array_merge(gradienColors(), gradienColors()));
$categories = __get('market_categories');
$categories = isset($categories[$section]) ? $categories[$section] : array();
if ($section == 'plugins' || $section == 'themes') {
    ?>
<div class="grid-market">

    <h2 class="section-title"><?php 
    _e('Featured');
    ?>
</h2>

        <?php 
    foreach ($aFeatured as $item) {
        drawMarketItem($item, $colors[array_rand($colors)]);
    }
    if (count($aFeatured) == 0) {
Example #26
0
function customHead()
{
    $items = __get("items");
    $max = __get("max");
    $reports = __get("reports");
    $max_views = __get("max_views");
    $latest_items = __get("latest_items");
    ?>
        <script type="text/javascript" src="https://www.google.com/jsapi"></script>
        <?php 
    if (count($items) > 0) {
        ?>
        <script type="text/javascript">
            // Load the Visualization API and the piechart package.
            google.load('visualization', '1', {'packages':['corechart']});

            // Set a callback to run when the Google Visualization API is loaded.
            google.setOnLoadCallback(drawChart);

            // Callback that creates and populates a data table, 
            // instantiates the pie chart, passes in the data and
            // draws it.
            function drawChart() {
                var data = new google.visualization.DataTable();
                var data2 = new google.visualization.DataTable();
                data.addColumn('string', '<?php 
        echo osc_esc_js(__('Date'));
        ?>
');
                data.addColumn('number', '<?php 
        echo osc_esc_js(__('Items'));
        ?>
');
                data2.addColumn('string', '<?php 
        echo osc_esc_js(__('Date'));
        ?>
');
                data2.addColumn('number', '<?php 
        echo osc_esc_js(__('Views'));
        ?>
');
                <?php 
        $k = 0;
        echo "data.addRows(" . count($items) . ");";
        foreach ($items as $date => $num) {
            echo "data.setValue(" . $k . ', 0, "' . $date . '");';
            echo "data.setValue(" . $k . ", 1, " . $num . ");";
            $k++;
        }
        $k = 0;
        echo "data2.addRows(" . count($reports) . ");";
        foreach ($reports as $date => $data) {
            echo "data2.setValue(" . $k . ', 0, "' . $date . '");';
            echo "data2.setValue(" . $k . ", 1, " . $data['views'] . ");";
            $k++;
        }
        ?>

                // Instantiate and draw our chart, passing in some options.
                var chart = new google.visualization.AreaChart(document.getElementById('placeholder'));
                chart.draw(data, {
                    colors:['#058dc7','#e6f4fa'],
                        areaOpacity: 0.1,
                        lineWidth:3,
                        hAxis: {
                        gridlines:{
                            color: '#333',
                            count: 3
                        },
                        viewWindow:'explicit',
                        showTextEvery: 2,
                        slantedText: false,
                        textStyle:{
                            color: '#058dc7',
                            fontSize: 10
                        }
                        },
                        vAxis: {
                            gridlines:{
                                color: '#DDD',
                                count: 4,
                                style: 'dooted'
                            },
                            viewWindow:'explicit',
                            baselineColor:'#bababa'

                        },
                        pointSize: 6,
                        legend: 'none',
                        chartArea:{
                            left:10,
                            top:10,
                            width:"95%",
                            height:"80%"
                        }
                    });

                var chart = new google.visualization.AreaChart(document.getElementById('placeholder_total'));
                chart.draw(data2, {
                    colors:['#058dc7','#e6f4fa'],
                        areaOpacity: 0.1,
                        lineWidth:3,
                        hAxis: {
                        gridlines:{
                            color: '#333',
                            count: 3
                        },
                        viewWindow:'explicit',
                        showTextEvery: 2,
                        slantedText: false,
                        textStyle:{
                            color: '#058dc7',
                            fontSize: 10
                        }
                        },
                        vAxis: {
                            gridlines:{
                                color: '#DDD',
                                count: 4,
                                style: 'dooted'
                            },
                            viewWindow:'explicit',
                            baselineColor:'#bababa'

                        },
                        pointSize: 6,
                        legend: 'none',
                        chartArea:{
                            left:10,
                            top:10,
                            width:"95%",
                            height:"80%"
                        }
                    });
            }
        </script>
<?php 
    }
}
Example #27
0
 * Osclass – software for creating and publishing online classified advertising platforms
 *
 * Copyright (C) 2012 OSCLASS
 *
 * This program is free software: you can redistribute it and/or modify it under the terms
 * of the GNU Affero General Public License as published by the Free Software Foundation,
 * either version 3 of the License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
 * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 * See the GNU Affero General Public License for more details.
 *
 * You should have received a copy of the GNU Affero General Public
 * License along with this program. If not, see <http://www.gnu.org/licenses/>.
 */
$category = __get("category");
$locales = OSCLocale::newInstance()->listAllEnabled();
?>
<div class="iframe-category">
    <h3><?php 
_e('Edit category');
?>
</h3>
    <form action="<?php 
echo osc_admin_base_url(true);
?>
" method="post">
        <input type="hidden" name="page" value="ajax" />
        <input type="hidden" name="action" value="edit_category_post" />
        <?php 
CategoryForm::primary_input_hidden($category);
function _liste(&$PDOdb)
{
    global $langs, $db, $user, $conf;
    llxHeader('', $langs->trans('ListOFAsset'), '', '');
    //getStandartJS();
    if (isset($_REQUEST['delete_ok'])) {
        ?>
		<br><div class="error"><?php 
        echo $langs->trans('OFAssetDeleted');
        ?>
</div><br>
		<?php 
    }
    $fk_soc = __get('fk_soc', 0, 'integer');
    $fk_product = __get('fk_product', 0, 'integer');
    $fk_commande = __get('fk_commande', 0, 'integer');
    if ($fk_product > 0) {
        dol_include_once('/core/lib/product.lib.php');
        $product = new Product($db);
        $result = $product->fetch($fk_product);
        $head = product_prepare_head($product, $user);
        $titre = $langs->trans("CardProduct" . $product->type);
        $picto = $product->type == 1 ? 'service' : 'product';
        dol_fiche_head($head, 'tabOF2', $titre, 0, $picto);
    } elseif ($fk_commande > 0) {
        dol_include_once("/core/lib/order.lib.php");
        $commande = new Commande($db);
        $result = $commande->fetch($fk_commande);
        $head = commande_prepare_head($commande, $user);
        $titre = $langs->trans("CustomerOrder" . $product->type);
        dol_fiche_head($head, 'tabOF3', $titre, 0, "order");
    }
    $form = new TFormCore();
    $assetOf = new TAssetOF();
    $r = new TSSRenderControler($assetOf);
    $sql = "SELECT ofe.rowid, ofe.numero, ofe.fk_soc, s.nom as client, SUM(ofel.qty) as nb_product_to_make\n\t\t, GROUP_CONCAT(DISTINCT ofel.fk_product SEPARATOR ',') as fk_product, p.label as product, ofe.ordre, ofe.date_lancement , ofe.date_besoin, ofe.fk_commande,ofe.fk_project\n\t\t, ofe.status, ofe.fk_user,ofe.total_estimated_cost, ofe.total_cost, '' AS printTicket\n\t\t  FROM " . MAIN_DB_PREFIX . "assetOf as ofe \n\t\t  LEFT JOIN " . MAIN_DB_PREFIX . "assetOf_line ofel ON (ofel.fk_assetOf=ofe.rowid AND ofel.type = 'TO_MAKE')\n\t\t  LEFT JOIN " . MAIN_DB_PREFIX . "product p ON (p.rowid = ofel.fk_product)\n\t\t  LEFT JOIN " . MAIN_DB_PREFIX . "societe s ON (s.rowid = ofe.fk_soc)\n\t\t  WHERE ofe.entity=" . $conf->entity;
    if ($fk_soc > 0) {
        $sql .= " AND ofe.fk_soc=" . $fk_soc;
    }
    if ($fk_product > 0) {
        $sql .= " AND ofel.fk_product=" . $fk_product;
    }
    if ($fk_commande > 0) {
        $sql .= " AND ofe.fk_commande=" . $fk_commande;
    }
    $sql .= " GROUP BY ofe.rowid ";
    // TODO je me rappelle plus pourquoi j'ai fait cette merde mais ça fait planter le tri, donc à virer.
    /*if($conf->global->ASSET_OF_LIST_BY_ROWID_DESC) $orderBy['ofe.rowid']='DESC';
    	else $orderBy['ofe.date_cre']='DESC';*/
    $TMath = array();
    $THide = array('rowid', 'fk_user', 'fk_product', 'fk_soc');
    if ($fk_commande > 0) {
        $THide[] = 'fk_commande';
    }
    if ($conf->global->OF_NB_TICKET_PER_PAGE == -1) {
        $THide[] = 'printTicket';
    }
    if (empty($user->rights->of->of->price)) {
        $THide[] = 'total_cost';
        $THide[] = 'total_estimated_cost';
    } else {
        $TMath['total_estimated_cost'] = 'sum';
        $TMath['total_cost'] = 'sum';
    }
    if (!empty($fk_product)) {
        $TMath['nb_product_to_make'] = 'sum';
    }
    $form = new TFormCore($_SERVER['PHP_SELF'], 'form', 'GET');
    echo $form->hidden('action', '');
    if ($fk_commande > 0) {
        echo $form->hidden('fk_commande', $fk_commande);
    }
    if ($fk_product > 0) {
        echo $form->hidden('fk_product', $fk_product);
    }
    // permet de garder le filtre produit quand on est sur l'onglet OF d'une fiche produit
    $r->liste($PDOdb, $sql, array('limit' => array('nbLine' => $conf->liste_limit), 'orderBy' => $orderBy, 'subQuery' => array(), 'link' => array('Utilisateur en charge' => '<a href="' . dol_buildpath('/user/card.php?id=@fk_user@', 2) . '">' . img_picto('', 'object_user.png', '', 0) . ' @val@</a>', 'numero' => '<a href="' . dol_buildpath('/of/fiche_of.php?id=@rowid@"', 2) . '>' . img_picto('', 'object_list.png', '', 0) . ' @val@</a>', 'printTicket' => '<input style=width:40px;"" type="number" value="' . (int) $conf->global->OF_NB_TICKET_PER_PAGE . '" name="printTicket[@rowid@]" min="0" />'), 'translate' => array(), 'hide' => $THide, 'type' => array('date_lancement' => 'date', 'date_besoin' => 'date', 'total_cost' => 'money', 'total_estimated_cost' => 'money', 'nb_product_to_make' => 'number'), 'math' => $TMath, 'liste' => array('titre' => $langs->trans('ListOFAsset'), 'image' => img_picto('', 'title.png', '', 0), 'picto_precedent' => img_picto('', 'back.png', '', 0), 'picto_suivant' => img_picto('', 'next.png', '', 0), 'noheader' => (int) isset($_REQUEST['fk_soc']) | (int) isset($_REQUEST['fk_product']), 'messageNothing' => "Il n'y a aucun " . $langs->trans('OFAsset') . " à afficher", 'picto_search' => img_picto('', 'search.png', '', 0)), 'title' => array('numero' => 'Numéro', 'fk_commande' => 'Commande client', 'ordre' => 'Priorité', 'date_lancement' => 'Date du lancement', 'date_besoin' => 'Date du besoin', 'status' => 'Status', 'login' => 'Utilisateur en charge', 'product' => 'Produit', 'client' => 'Client', 'nb_product_to_make' => 'Nb produits à fabriquer', 'total_cost' => 'Coût réel', 'total_estimated_cost' => 'Coût prévu', 'printTicket' => 'impression<br />étiquette', 'fk_project' => 'Projet'), 'orderBy' => array('rowid' => 'DESC'), 'eval' => array('ordre' => 'TAssetOF::ordre(@val@)', 'status' => 'TAssetOF::status(@val@)', 'product' => 'get_format_libelle_produit("@fk_product@")', 'client' => 'get_format_libelle_societe(@fk_soc@)', 'fk_commande' => 'get_format_libelle_commande(@fk_commande@)', 'fk_project' => 'get_format_libelle_projet(@fk_project@)'), 'search' => array('numero' => array('recherche' => true, 'table' => 'ofe'), 'date_lancement' => array('recherche' => 'calendars', 'table' => 'ofe'), 'date_besoin' => array('recherche' => 'calendars', 'table' => 'ofe'), 'status' => array('recherche' => TAssetOF::$TStatus, 'table' => 'ofe'))));
    if ($conf->global->OF_NB_TICKET_PER_PAGE != -1) {
        echo '<p align="right"><input class="button" type="button" onclick="$(this).closest(\'form\').find(\'input[name=action]\').val(\'printTicket\');  $(this).closest(\'form\').submit(); " name="print" value="' . $langs->trans('ofPrintTicket') . '" /></p>';
    }
    $form->end();
    // On n'affiche pas le bouton de création d'OF si on est sur la liste OF depuis l'onglet "OF" de la fiche commande
    if ($fk_commande) {
        $commande = new Commande($db);
        $commande->fetch($fk_commande);
        $r2 = new TSSRenderControler($assetOf);
        $sql = "SELECT c.rowid as fk_commandedet, p.rowid as rowid, p.ref as refProd, p.label as nomProd, c.qty as qteCommandee, c.description, c.product_type";
        $sql .= " FROM " . MAIN_DB_PREFIX . "commandedet c LEFT JOIN " . MAIN_DB_PREFIX . "product p";
        $sql .= " ON (c.fk_product = p.rowid)";
        $sql .= " WHERE c.product_type IN (0,9) AND  c.fk_commande = " . $fk_commande;
        $resql = $db->query($sql);
        //var_dump($db);
        $num = $db->num_rows($resql);
        print_barre_liste($langs->trans('ListOrderProducts'), $page, "liste.php", $param, $sortfield, $sortorder, '', $num);
        $i = 0;
        $form = new TFormCore($_SERVER['PHP_SELF'], 'formMakeOk', 'post');
        echo $form->hidden('fk_commande', __get('fk_commande', 0, 'int'));
        echo $form->hidden('action', 'createOFCommande');
        echo $form->hidden('fk_soc', $commande->socid);
        echo $form->hidden('token', $_SESSION['newtoken']);
        print '<table class="noborder" width="100%">';
        print '<tr class="liste_titre">';
        print_liste_field_titre("#");
        print_liste_field_titre($langs->trans("Ref"), "liste_of.php", "ref", "", $param, '', $sortfield, $sortorder);
        print_liste_field_titre($langs->trans("Label"), "liste_of.php", "label", "", $param, 'align="left"', $sortfield, $sortorder);
        print_liste_field_titre($langs->trans("Quantité à produire"), "liste_of.php", "", "", $param, '', $sortfield, $sortorder);
        print_liste_field_titre($langs->trans("Produits à ajouter à un OF"), "liste_of.php", "", "", $param, '', $sortfield, $sortorder);
        print "</tr>\n";
        $var = 1;
        $bc = array(1 => 'class="pair"', -1 => 'class="impair"');
        while ($prod = $db->fetch_object($resql)) {
            $var = !$var;
            //print "<tr ".$bc[$var].">";
            if ($prod->product_type == 9) {
                print "<tr>";
                print "<td>&nbsp;</td>";
                print "<td colspan=\"4\"><strong>";
                print $prod->description;
                print '</strong></td>';
            } else {
                if (empty($prod->rowid)) {
                    // ligne libre
                    print "<tr>";
                    print "<td>&nbsp;</td>";
                    print "<td colspan=\"4\">";
                    print $prod->description;
                    print '</td>';
                } else {
                    print "<tr " . $bc[$var] . ">";
                    print "<td>" . ($i + 1) . "</td>";
                    print "<td>";
                    $p_static = new Product($db);
                    $p_static->ref = $prod->refProd;
                    $p_static->id = $prod->rowid;
                    print $p_static->getNomUrl(1);
                    print "</td>\n";
                    print '<td>';
                    print $prod->nomProd;
                    print '</td>';
                    print "<td>";
                    print $form->texte('', 'TQuantites[' . $prod->fk_commandedet . ']', $prod->qteCommandee, 3, 255);
                    print "</td>";
                    print "<td>" . $form->checkbox1('', 'TProducts[' . $prod->fk_commandedet . '][' . (int) $prod->rowid . ']', false, true, '', 'checkOF');
                    print "</td>";
                    print "</tr>\n";
                    $i++;
                }
            }
        }
        print '<tr class="liste_titre">';
        echo '<th class="liste_titre" colspan="2">&nbsp;</th><th class="liste_titre">&nbsp;</th><th class="liste_titre">&nbsp;</th>
		<th class="liste_titre"><input type="checkbox" id="checkall" checked="checked" value="1"></th>
		';
        print '</tr>';
        print "</table>";
        ?>
<script type="text/javascript">
			$('input#checkall').change(function() {
				
				$('input.checkOF').prop('checked',$(this).is(':checked'));	
				
			});
			
		</script>
		
		<?php 
        echo '<p align="right">' . $form->btsubmit('Créer OFs', 'subForm') . ' ' . $form->btsubmit('Créer un seul OF', 'subFormAlone') . '</p>';
        $form->end();
        echo '</div>';
        $db->free($resql);
    } else {
        if (!empty($fk_product)) {
            $sql = "SELECT ofe.rowid, ofe.numero, ofe.fk_soc, s.nom as client, SUM(IF(ofel.qty>0,ofel.qty,ofel.qty_needed) ) as nb_product_needed, ofel.fk_product, p.label as product, ofe.ordre, ofe.date_lancement , ofe.date_besoin\n            , ofe.status, ofe.fk_user, ofe.total_cost\n              FROM " . MAIN_DB_PREFIX . "assetOf as ofe \n              LEFT JOIN " . MAIN_DB_PREFIX . "assetOf_line ofel ON (ofel.fk_assetOf=ofe.rowid AND ofel.type = 'NEEDED')\n              LEFT JOIN " . MAIN_DB_PREFIX . "product p ON p.rowid = ofel.fk_product\n              LEFT JOIN " . MAIN_DB_PREFIX . "societe s ON s.rowid = ofe.fk_soc\n              WHERE ofe.entity=" . $conf->entity . " AND ofel.fk_product=" . $fk_product . " AND ofe.status!='CLOSE'";
            $sql .= " GROUP BY ofe.rowid ";
            if ($conf->global->ASSET_OF_LIST_BY_ROWID_DESC) {
                $orderBy['ofe.rowid'] = 'DESC';
            } else {
                $orderBy['ofe.date_cre'] = 'DESC';
            }
            $TMath = array();
            $THide = array('rowid', 'fk_user', 'fk_product', 'fk_soc');
            if (empty($user->rights->asset->of->price)) {
                $THide[] = 'total_cost';
            } else {
                $TMath['total_cost'] = 'sum';
            }
            $TMath['nb_product_needed'] = 'sum';
            $l = new TListviewTBS('listeofproductneeded');
            echo $langs->trans('ofListProductNeeded');
            echo $l->render($PDOdb, $sql, array('limit' => array('nbLine' => $conf->liste_limit), 'orderBy' => $orderBy, 'subQuery' => array(), 'link' => array('Utilisateur en charge' => '<a href="' . dol_buildpath('/user/card.php?id=@fk_user@', 2) . '">' . img_picto('', 'object_user.png', '', 0) . ' @val@</a>', 'numero' => '<a href="' . dol_buildpath('/of/fiche_of.php?id=@rowid@', 2) . '">' . img_picto('', 'object_list.png', '', 0) . ' @val@</a>', 'product' => '<a href="' . dol_buildpath('/product/card.php?id=@fk_product@', 2) . '">' . img_picto('', 'object_product.png', '', 0) . ' @val@</a>', 'client' => '<a href="' . dol_buildpath('/societe/soc.php?id=@fk_soc@', 2) . '">' . img_picto('', 'object_company.png', '', 0) . ' @val@</a>'), 'translate' => array(), 'hide' => $THide, 'type' => array('date_lancement' => 'date', 'date_besoin' => 'date', 'total_cost' => 'money', 'nb_product_needed' => 'number'), 'math' => $TMath, 'liste' => array('titre' => $langs->trans('ListOFAsset'), 'image' => img_picto('', 'title.png', '', 0), 'picto_precedent' => img_picto('', 'back.png', '', 0), 'picto_suivant' => img_picto('', 'next.png', '', 0), 'noheader' => (int) isset($_REQUEST['fk_soc']) | (int) isset($_REQUEST['fk_product']), 'messa geNothing' => "Il n'y a aucun " . $langs->trans('OFAsset') . " à afficher", 'picto_search' => img_picto('', 'search.png', '', 0)), 'title' => array('numero' => 'Numéro', 'ordre' => 'Priorité', 'date_lancement' => 'Date du lancement', 'date_besoin' => 'Date du besoin', 'status' => 'Status', 'login' => 'Utilisateur en charge', 'product' => 'Produit', 'client' => 'Client', 'nb_product_needed' => 'Nb produits nécessaire', 'total_cost' => 'Coût'), 'eval' => array('ordre' => 'TAssetOF::ordre(@val@)', 'status' => 'TAssetOF::status(@val@)', 'product' => 'get_format_libelle_produit(@fk_product@)', 'client' => 'get_format_libelle_societe(@fk_soc@)')));
        }
        echo '<div class="tabsAction">';
        echo '<a id="bt_createOf" class="butAction" href="fiche_of.php?action=new' . (!empty($fk_product) ? '&fk_product=' . $fk_product : '') . '">' . $langs->trans('CreateOFAsset') . '</a>';
        if ($conf->nomenclature->enabled && !empty($fk_product)) {
            dol_include_once('/core/class/html.form.class.php');
            dol_include_once('/asset/lib/asset.lib.php');
            dol_include_once('/nomenclature/class/nomenclature.class.php');
            $doliForm = new Form($db);
            echo $doliForm->selectarray('fk_nomenclature', TNomenclature::get($PDOdb, $fk_product, true));
            echo '<script type="text/javascript">

				    var url_create_of = $("#bt_createOf").attr("href");
	                   	    $("#bt_createOf").attr("href","#");  
                        
					$("#bt_createOf").click(function() {
						var fk_nomenclature = $("select[name=fk_nomenclature]").val();
						var href = url_create_of + "&fk_nomenclature=" + fk_nomenclature;
						$(this).attr("href", href);
					});
			</script>';
        }
        echo '</div>';
    }
    $PDOdb->close();
    llxFooter('');
}
Example #29
0
 * OSClass – software for creating and publishing online classified advertising platforms
 *
 * Copyright (C) 2010 OSCLASS
 *
 * This program is free software: you can redistribute it and/or modify it under the terms
 * of the GNU Affero General Public License as published by the Free Software Foundation,
 * either version 3 of the License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
 * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 * See the GNU Affero General Public License for more details.
 *
 * You should have received a copy of the GNU Affero General Public
 * License along with this program. If not, see <http://www.gnu.org/licenses/>.
 */
$aCurrencies = __get('aCurrencies');
$last = end($aCurrencies);
$last_id = $last['pk_c_code'];
?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" dir="ltr" lang="en-US">
    <head>
        <?php 
osc_current_admin_theme_path('head.php');
?>
    </head>
    <body>
        <?php 
osc_current_admin_theme_path('header.php');
?>
Example #30
0
function customHead()
{
    $items = __get('item_stats');
    $users = __get('user_stats');
    ?>
        <script type="text/javascript" src="https://www.google.com/jsapi"></script>
        <script type="text/javascript">
            google.load('visualization', '1', {'packages':['corechart']});
            google.setOnLoadCallback(drawChartListing);
            google.setOnLoadCallback(drawChartUser);

            function drawChartListing() {
                var data = new google.visualization.DataTable();
                data.addColumn('string', '<?php 
    _e('Date');
    ?>
');
                data.addColumn('number', '<?php 
    _e('Listings');
    ?>
');
                data.addColumn({type:'boolean',role:'certainty'});
                <?php 
    $k = 0;
    echo "data.addRows(" . count($items) . ");";
    foreach ($items as $date => $num) {
        echo "data.setValue(" . $k . ', 0, "' . $date . '");';
        echo "data.setValue(" . $k . ", 1, " . $num . ");";
        $k++;
    }
    $k = 0;
    ?>

                // Instantiate and draw our chart, passing in some options.
                var chart = new google.visualization.AreaChart(document.getElementById('placeholder-listing'));
                chart.draw(data, {
                    colors:['#058dc7','#e6f4fa'],
                        areaOpacity: 0.1,
                        lineWidth:3,
                        hAxis: {
                        gridlines:{
                            color: '#333',
                            count: 3
                        },
                        viewWindow:'explicit',
                        showTextEvery: 2,
                        slantedText: false,
                        textStyle:{
                            color: '#058dc7',
                            fontSize: 10
                        }
                        },
                        vAxis: {
                            gridlines:{
                                color: '#DDD',
                                count: 4,
                                style: 'dooted'
                            },
                            viewWindow:'explicit',
                            baselineColor:'#bababa'

                        },
                        pointSize: 6,
                        legend: 'none',
                        chartArea:{
                            left:10,
                            top:10,
                            width:"95%",
                            height:"88%"
                        }
                    });
            }

            function drawChartUser() {
                var data = new google.visualization.DataTable();
                data.addColumn('string', '<?php 
    _e('Date');
    ?>
');
                data.addColumn('number', '<?php 
    _e('Users');
    ?>
');
                data.addColumn({type:'boolean',role:'certainty'});
                <?php 
    $k = 0;
    echo "data.addRows(" . count($users) . ");";
    foreach ($users as $date => $num) {
        echo "data.setValue(" . $k . ', 0, "' . $date . '");';
        echo "data.setValue(" . $k . ", 1, " . $num . ");";
        $k++;
    }
    $k = 0;
    ?>

                // Instantiate and draw our chart, passing in some options.
                var chart = new google.visualization.AreaChart(document.getElementById('placeholder-user'));
                chart.draw(data, {
                    colors:['#058dc7','#e6f4fa'],
                    areaOpacity: 0.1,
                    lineWidth:3,
                    hAxis: {
                    gridlines:{
                        color: '#333',
                        count: 3
                    },
                    viewWindow:'explicit',
                    showTextEvery: 2,
                    slantedText: false,
                    textStyle:{
                        color: '#058dc7',
                        fontSize: 10
                    }
                    },
                    vAxis: {
                        gridlines:{
                            color: '#DDD',
                            count: 4,
                            style: 'dooted'
                        },
                        viewWindow:'explicit',
                        baselineColor:'#bababa'

                    },
                    pointSize: 6,
                    legend: 'none',
                    chartArea:{
                        left:10,
                        top:10,
                        width:"95%",
                        height:"88%"
                    }
                });
            }

            $(document).ready(function() {
                $("#widget-box-stats-select").bind('change', function () {
                    if( $(this).val() == 'users' ) {
                        $('#widget-box-stats-listings').css('visibility', 'hidden');
                        $('#widget-box-stats-users').css('visibility', 'visible');
                    } else {
                        $('#widget-box-stats-users').css('visibility', 'hidden');
                        $('#widget-box-stats-listings').css('visibility', 'visible');
                    }
                });
            });
        </script>
<?php 
}