/**
  * Display a listing of the resource.
  *
  * @return Response
  */
 public function index()
 {
     $permission = $this->permission->get();
     $table = Table::create($permission);
     $table->setColumns(['id', 'name', 'description']);
     $table->addColumn('', 'Edit', function ($model) {
         return "<a href='" . action('Permissions\\PermissionsController@edit', ['slug' => $model->slug]) . "' class='btn btn-info'>Edit</a>";
     });
     $table->addColumn('delete', 'Delete', function ($model) {
         //return "<a href='".route('users_destroy',['id' => $model->id])."'><img src='/img/edit.svg' /></a>";
         return delete_button('permissions_destroy', $model->id);
     });
     return View('permissions.index', compact('permission', 'table'));
 }
Example #2
0
 /**
  * Display a listing of the resource.
  *
  * @return Response
  */
 public function index()
 {
     $users = $this->user->get();
     $table = Table::create($users);
     $table->setColumns(['id', 'name', 'email']);
     $table->addColumn('edit', 'Edit', function ($model) {
         return "<a href='" . action('UsersController@edit', ['id' => $model->id]) . "' class='btn btn-info'>Edit</a>";
     });
     $table->addColumn('delete', 'Delete', function ($model) {
         //return "<a href='".route('users_destroy',['id' => $model->id])."'><img src='/img/edit.svg' /></a>";
         return delete_button('users_destroy', $model->id);
     });
     return view('cms.users.index', compact('users', 'table'));
 }
Example #3
0
 public function xhtml()
 {
     global $ID;
     $ns = getNS($ID);
     list($files, $subprojects) = Projects_file::project_files($ns);
     $generated = array();
     $source = array();
     foreach ($files as $id => $file) {
         if ($file->type() == 'source') {
             $source[$id] = $file;
         } elseif ($file->type() == 'generated') {
             $generated[$id] = $file;
         }
     }
     ksort($generated);
     ksort($source);
     sort($subprojects);
     echo '<h1>Source files</h1>' . DOKU_LF;
     echo '<ul>' . DOKU_LF;
     echo '<li>' . create_button('source') . '</li>' . DOKU_LF;
     foreach ($source as $id => $file) {
         echo '<li>' . html_wikilink($id) . ': ' . download_button($id) . ', ' . delete_button($id) . '</li>' . DOKU_LF;
     }
     echo '</ul>' . DOKU_LF;
     echo '<h1>Generated files</h1>' . DOKU_LF;
     echo '<ul>' . DOKU_LF;
     echo '<li>' . create_button('generated') . '</li>' . DOKU_LF;
     foreach ($generated as $id => $file) {
         $make = make_button($id, $file->status() == PROJECTS_MADE);
         echo '<li>' . html_wikilink($id) . ': ' . download_button($id) . ', ' . delete_button($id) . ', ' . $make . '</li>' . DOKU_LF;
     }
     echo '</ul>' . DOKU_LF;
     echo '<h1>Subprojects</h1>' . DOKU_LF;
     echo '<ul>' . DOKU_LF;
     echo '<li>' . create_button($ID, 'project') . '</li>' . DOKU_LF;
     foreach ($subprojects as $sub) {
         echo '<li><a href="' . wl($sub . ':', array('do' => 'manage_files')) . '">' . noNS($sub) . '</a></li>' . DOKU_LF;
     }
     echo '</ul>' . DOKU_LF;
     if ($ns) {
         $name = getNS($ns);
         $id = $name . ':';
         if (!$name) {
             $id = '/';
             $name = '/ (root)';
         }
         echo '<h1>Parent projects</h1>' . DOKU_LF;
         echo '<ul><li><a href="' . wl($id, array('do' => 'manage_files')) . '">' . $name . '</a></li></ul>' . DOKU_LF;
     }
 }
Example #4
0
function delete_ranking($dbh, $rank_id)
{
    foreach ($rank_id as $id) {
        $sql = 'SELECT movie_id FROM movie WHERE rank_id = ?';
        $stmt = $dbh->prepare($sql);
        $data[] = $id;
        $stmt->execute($data);
        $data = array();
        while (true) {
            $rec = $stmt->fetch(PDO::FETCH_ASSOC);
            if ($rec == false) {
                break;
            }
            delete_movies($dbh, $rec['movie_id']);
        }
        delete_button($dbh, $id);
        $sql = 'DELETE FROM ranking WHERE rank_id = ?';
        $stmt = $dbh->prepare($sql);
        $data[] = $id;
        $stmt->execute($data);
        $data = array();
    }
}
Example #5
0
 public function __construct($parent, $file)
 {
     global $ID;
     global $REV;
     parent::__construct($parent, 'Summary');
     $list = $this->newElement('ul');
     $this->root->appendChild($list);
     $info = $this->newElement('li');
     $text = ': ' . $file->type() . ' file';
     $info->appendChild($this->loadElement(html_wikilink($ID)));
     $info->appendChild($this->newElement('span', array(), $text));
     $list->appendChild($info);
     $format = 'D M d, Y \\a\\t g:i:s a';
     if (date_default_timezone_get() == 'UTC') {
         $format .= ' e';
     }
     $date = $REV ? $REV : $file->modified_date();
     if (!$date) {
         $meta = Projects_file::file($file->id());
         $date = $meta ? $meta->modified_date() : time();
     }
     $updated = $this->newElement('li', array(), 'modified on: ' . date($format, $date));
     $list->appendChild($updated);
     $actions = $this->newElement('li', array(), "Actions: ");
     $list->appendChild($actions);
     $this->actions = $this->newElement('span');
     $actions->appendChild($this->actions);
     $this->newAction(manage_files_button($ID));
     if (!$REV) {
         $this->newAction(download_button($ID));
     }
     if (auth_quickaclcheck($ID) >= AUTH_DELETE) {
         $this->newAction(delete_button($ID));
     }
     $this->content = $this->newElement('div', array('id' => 'PROJECTS_content'));
     if ($file->is_making()) {
         $time = time() - $file->status()->started();
         $content = '<div id="PROJECTS_progress">The file has been generating for ' . self::format_time($time) . ': ' . kill_button($file->id(), FALSE) . DOKU_LF;
         foreach ($file->status()->made() as $made) {
             $content .= '<div class="success">' . html_wikilink($made) . '</div>' . DOKU_LF;
         }
         $content .= '<div class="notify">' . html_wikilink($file->status()->making()) . '</div>' . DOKU_LF;
         foreach ($file->status()->queue() as $queue) {
             $content .= '<div class="info">' . html_wikilink($queue) . '</div>' . DOKU_LF;
         }
         $this->setContent($content . '</div>');
     } else {
         if (is_array($file->status())) {
             $content = '<div>Error in file generation:' . DOKU_LF;
             foreach ($file->status() as $id => $errors) {
                 foreach ($errors as $error) {
                     $content .= '<div class="error">' . html_wikilink($id) . ': ' . $error . '</div>' . DOKU_LF;
                 }
             }
             $this->setContent($content . '</div>');
         }
     }
     $this->root->appendChild($this->content);
 }
check_login();
$tpl = new pTemplate();
$tpl->define_dynamic('page', $cfg['ADMIN_TEMPLATE_PATH'] . '/custom_menus.tpl');
$tpl->define_dynamic('page_message', 'page');
$tpl->define_dynamic('hosting_plans', 'page');
$tpl->define_dynamic('button_list', 'page');
$tpl->define_dynamic('button_list', 'page');
$tpl->define_dynamic('add_button', 'page');
$tpl->define_dynamic('edit_button', 'page');
global $cfg;
$theme_color = $cfg['USER_INITIAL_THEME'];
$tpl->assign(array('TR_ADMIN_CUSTOM_MENUS_PAGE_TITLE' => tr('VHCS - Admin - Manage custom menus'), 'THEME_COLOR_PATH' => "../themes/{$theme_color}", 'THEME_CHARSET' => tr('encoding'), 'ISP_LOGO' => get_logo($_SESSION['user_id']), 'VHCS_LICENSE' => $cfg['VHCS_LICENSE']));
gen_admin_menu($tpl);
add_new_button($tpl, $sql);
if (isset($_GET['delete_id'])) {
    delete_button($tpl, $sql);
}
if (isset($_GET['edit_id'])) {
    edit_button($tpl, $sql);
}
update_button($tpl, $sql);
gen_button_list($tpl, $sql);
$tpl->assign(array('TR_TITLE_CUSTOM_MENUS' => tr('Manage custom menus'), 'TR_ADD_NEW_BUTTON' => tr('Add new button'), 'TR_BUTTON_NAME' => tr('Button name'), 'TR_BUTTON_LINK' => tr('Button link'), 'TR_BUTTON_TARGET' => tr('Button target'), 'TR_VIEW_FROM' => tr('Show in'), 'RESELLER' => tr('Reseller level'), 'USER' => tr('Enduser level'), 'RESSELER_AND_USER' => tr('Reseller and enduser level'), 'TR_ADD' => tr('Add'), 'TR_MENU_NAME' => tr('Menu button'), 'TR_ACTON' => tr('Action'), 'TR_EDIT' => tr('Edit'), 'TR_DELETE' => tr('Delete'), 'TR_LEVEL' => tr('Level'), 'TR_SAVE' => tr('Save'), 'TR_EDIT_BUTTON' => tr('Edit button')));
gen_page_message($tpl);
if (isset($_GET['edit_id'])) {
    $tpl->assign('ADD_BUTTON', '');
} else {
    $tpl->assign('EDIT_BUTTON', '');
}
$tpl->parse('PAGE', 'page');
$tpl->prnt();