Esempio n. 1
0
 public static function getView($f_mvType, $f_szObjectID)
 {
     $arrViewTypes = !is_array($f_mvType) || 1 > count($f_mvType) ? array((string) $f_mvType) : $f_mvType;
     foreach ($arrViewTypes as $szViewType) {
         if (false !== ($iViewId = self::$__db->select_one('specific_view_selections', 'view_id', "object_id = '" . $f_szObjectID . "' AND view_type = '" . $szViewType . "'"))) {
             return AROView::finder()->byPK($iViewId);
         }
         if ($objView = AROView::finder()->findFirst("CONCAT(',',type,',') LIKE ? ORDER BY o ASC", '%,' . $szViewType . ',%')) {
             return $objView;
         }
     }
 }
Esempio n. 2
0
<?php

require_once 'cfg_admin.php';
logincheck();
$g_objAdmin->checkEditViewAccess();
$objView = AROView::finder()->byPK($_REQUEST['id']);
$szViewFile = PROJECT_VIEWS . '/' . $objView->id . '.php';
if (!empty($_GET['deleteme'])) {
    $objView->delete();
    unlink($szViewFile);
    header('Location: ../');
    exit;
} else {
    if (isset($_POST['title'], $_POST['content'], $_POST['type'])) {
        require_once PROJECT_INCLUDE . '/Dwoo-1.1.1/Dwoo/dwooAutoload.php';
        $template_source = $_POST['content'];
        $template = new Dwoo_Template_String($template_source);
        $dwoo = new Dwoo();
        $compiler = new Dwoo_Compiler();
        $compiler->setDelimiters('<?', '?>');
        $dwoo->setCompiler($compiler);
        try {
            $compiled_template_source = $dwoo->testTemplate($template);
            //	echo '<pre>'.htmlspecialchars($template_source).'</pre>';
            //	echo '<p>is a valid template:</p>';
            //	exit('<pre>'.htmlspecialchars(file_get_contents($compiled_template_source)).'</pre>');
        } catch (Dwoo_Exception $exc) {
            echo '<pre style="background-color:pink;">' . htmlspecialchars($template_source) . '</pre>';
            echo '<p>is NOT a valid template:</p>';
            exit('<pre style="background-color:pink;">' . $exc->getMessage() . '</pre>');
        }
Esempio n. 3
0
<?php

require_once 'cfg_admin.php';
logincheck();
$g_objAdmin->checkEditViewAccess();
if (isset($_POST['sortorder'])) {
    foreach (explode(',', $_POST['sortorder']) as $o => $vid) {
        $db->update('views', 'o = ' . ($o + 1), 'id = ' . $vid);
    }
    header('Location: ' . $_SERVER['HTTP_REFERER']);
    exit;
}
tpl_header();
echo '<table border="1"><thead><tr><th colspan="4">Templates</th></tr></thead><tbody id="tb_views">';
$arrViews = AROView::finder()->findMany('1 ORDER BY o ASC');
foreach ($arrViews as $view) {
    echo '<tr vid="' . $view->id . '"><th>' . $view->o . '</th><td>' . $view->title . '</td><td>&nbsp;</td><td>' . str_replace(',', ', ', $view->type) . '</td></tr>';
}
echo '</tbody></table>';
?>

<form method="post" action="" onsubmit="this.elements.sortorder.value=getOrder();">
<input type="hidden" name="sortorder" value="" />
<input type="submit" value="Save order" />
</form>
<script type="text/javascript">
function getOrder() {
	return $$('#tb_views tr[vid]').map(function(tr){ return tr.attr('vid'); }).join(',');
}
doMySortable($('tb_views'));
</script>