示例#1
0
 *
 * This library 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 Lesser General Public
 * License along with this library.  If not, see <http://www.gnu.org/licenses/>.
 *
 */
// Check if we are a user
OCP\User::checkLoggedIn();
OCP\App::checkAppEnabled('storagecharts2');
$tmpl = new OCP\Template('storagecharts2', 'tpl.settings');
if (isset($_POST['storagecharts2_disp']) && count($_POST['storagecharts2_disp']) <= 3) {
    $c = $_POST['storagecharts2_disp'];
    $c_disp = array('cpie_rfsus' => 0, 'clines_usse' => 0, 'chisto_us' => 0);
    foreach (array_keys($c_disp) as $chart) {
        if (in_array($chart, $c)) {
            $c_disp[$chart] = 1;
        }
    }
    OC_DLStCharts::setUConfValue('c_disp', serialize($c_disp));
    $tmpl->assign('stc_save_ok', TRUE);
}
$displays = OC_DLStCharts::getUConfValue('c_disp', array('uc_val' => 'a:3:{s:10:"cpie_rfsus";i:1;s:11:"clines_usse";i:1;s:9:"chisto_us";i:1;}'));
$tmpl->assign('displays', unserialize($displays['uc_val']));
// workaround to detect OC version
$ocVersion = @reset(OCP\Util::getVersion());
$tmpl->assign('ocVersion', $ocVersion);
return $tmpl->fetchPage();
示例#2
0
* modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
* License as published by the Free Software Foundation; either 
* version 3 of the License, or any later version.
* 
* This library 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 Lesser General Public 
* License along with this library.  If not, see <http://www.gnu.org/licenses/>.
* 
*/
OCP\JSON::checkLoggedIn();
OCP\JSON::checkAppEnabled('storagecharts2');
$l = new OC_L10N('storagecharts2');
// Update and save the new configuration
if (is_numeric($_POST['s']) && in_array($_POST['k'], array('hu_size', 'hu_size_hus', 'hu_ratio'))) {
    OC_DLStCharts::setUConfValue($_POST['k'], $_POST['s']);
    switch ($_POST['k']) {
        case 'hu_size':
            OCP\JSON::encodedPrint(array('r' => OC_DLStChartsLoader::loadChart('chisto_us', $l)));
            break;
        case 'hu_size_hus':
            OCP\JSON::encodedPrint(array('r' => OC_DLStChartsLoader::loadChart('clines_usse', $l)));
            break;
    }
} else {
    // default
    OCP\JSON::encodedPrint(array('r' => OC_DLStChartsLoader::loadChart('cpie_rfsus', $l)));
}