Exemplo n.º 1
0
<?php

require_once '../../views/_secureHead.php';
require_once $relative_base_path . 'models/edit.php';
if (isset($sessionManager) && $sessionManager->isAuthorized()) {
    $BOOKMARK_ID = request_isset('id');
    $bookmarkManager = new BookmarkManager();
    $record = $bookmarkManager->getRecord($BOOKMARK_ID);
    $page_title = 'Edit | Bookmarks';
    // build edit view
    $editModel = new EditModel('Edit', 'update_by_id', $BOOKMARK_ID);
    $editModel->addRow('title', 'Title', $record->getTitle());
    $editModel->addRow('url', 'URL', $record->getUrl());
    $views_to_load = array();
    $views_to_load[] = ' ' . EditView2::render($editModel);
    include $relative_base_path . 'views/_generic.php';
}
Exemplo n.º 2
0
        foreach ($ids as $id) {
            $doc = new Thrudoc_Element();
            $doc->key = $id->key;
            $doc->bucket = THRUDOC_BUCKET;
            array_push($docs, $doc);
        }
        return $docs;
    }
    private function print_bookmarks($bookmarks)
    {
        $i = 1;
        foreach ($bookmarks as $b) {
            print "{$i} .\ttitle :\t" . $b->title . "\n";
            print "\turl   :\t(" . $b->url . ")\n";
            print "\ttags  :\t(" . $b->tags . ")\n";
            $i++;
        }
    }
}
//################################
//#            Main
//################################
$bm = new BookmarkManager();
try {
    $bm->load_tsv_file("../bookmarks.tsv");
    $bm->find("tags:(+css +examples)", array("random" => true));
    $bm->find("title:(linux)", array("sortby" => "title"));
    $bm->remove_all();
} catch (TException $tx) {
    print 'TException: ' . $tx->getMessage() . "\n";
}
Exemplo n.º 3
0
 $title = request_isset('title');
 $url = request_isset('url');
 switch ($page_action) {
     case 'update_by_id':
         $db_update_success = BookmarkManager::updateRecord($id, $title, $url);
         break;
     case 'add_bookmark':
         $db_update_success = BookmarkManager::addRecord($title, $url);
         break;
     case 'delete_by_id':
         $db_delete_success = BookmarkManager::deleteRecord($id);
         break;
 }
 $page_title = 'Bookmarks';
 $search_target = 'bookmarks';
 $bookmark_data = BookmarkManager::getAllRecords();
 $alt_menu = getAddButton() . getSearchButton();
 $searchModel = new SearchModel($search_target);
 $addModel = new AddModel('Add', 'add_bookmark');
 $addModel->addRow('title', 'Title');
 $addModel->addRow('url', 'URL');
 $bookmarkModel = new TableModel('', $search_target);
 /*$bookmarkModel->addRow ( array (
 			TableView2::createCell ('site', 'Site', 'th'),
 			TableView2::createCell ()
 		));*/
 while (($bookmark_row = mysql_fetch_array($bookmark_data)) != null) {
     $target = $sbookmark ? ' target="_blank"' : '';
     $bookmarkModel->addRow(array(TableView2::createCell('bookmark', '<a href="' . $bookmark_row['url'] . '" ' . $target . '>' . $bookmark_row['title'] . '</a>'), TableView2::createEdit($bookmark_row['BOOKMARK_ID'])));
 }
 $views_to_load = array();