コード例 #1
0
ファイル: edit.php プロジェクト: coldtrick/quicklinks
<?php

/**
 * Save/edit a quicklink items
 *
 * @todo support edit
 * @todo sticky form
 */
$title = get_input('title');
$url = get_input('url');
$container_guid = (int) get_input('container_guid');
if (empty($url)) {
    register_error(elgg_echo('error:missing_data'));
    forward(REFERER);
}
$entity = new QuickLink();
$entity->container_guid = $container_guid;
$entity->title = $title;
$entity->description = $url;
if ($entity->save()) {
    add_entity_relationship(elgg_get_logged_in_user_guid(), QUICKLINKS_RELATIONSHIP, $entity->getGUID());
    system_message(elgg_echo('save:success'));
} else {
    register_error(elgg_echo('save:fail'));
}
forward(REFERER);
 public function run()
 {
     QuickLink::create(['name' => 'Forums', 'url' => 'http://lethal-zone.eu/forum', 'icon' => 'fa fa-external-link']);
     QuickLink::create(['name' => 'IRC', 'url' => 'http://webchat.quakenet.org/?randomnick=1&channels=lethalzone', 'icon' => 'fa fa-comment']);
 }
コード例 #3
0
| application. Here you may also register your custom route filters.
|
*/
App::before(function ($request) {
    /**
     * Share the pages the user is able to access to the views under 
     * the $pages variable.
     *
     */
    View::share('pages', Access::pages());
    /**
     * Share the quick links with the views using the
     * the $quickLinks variable.
     *
     */
    View::share('quickLinks', QuickLink::get(['name', 'url', 'icon']));
    /**
     * Share the site options with the views under
     * the $siteOptions variable.
     *
     */
    $options = Option::get(['name', 'value']);
    foreach ($options as $option) {
        $o[$option->name] = $option->value;
    }
    View::share('siteOptions', $o);
    /**
     * Attach a PHP array to the window to allow JavaScript to use.
     * The "URL" provider is used rather than the Laravel helper paths
     * to ensure the paths are consistent across Windows and Unix platforms.
     *