function renderUI($prefix = false) { $out = ''; $out .= sprintf('<input type="text" value="%s" name="%s", size="64">', $this->getHtmlSafe(), $this->getName()); require_once ROOT . '/class/url.class.php'; $url = new url(); $url->set('class', 'file'); $url->set('mode', 'field'); $url->set('field', $this->getName()); $out .= ' <a class="action_button" href="' . $url->render('browser.php') . '" target="_blank" onClick="popup(\'' . $url->render('browser.php') . '\');return false">' . translate('browse_button') . '</a>'; if ($filesystem = $this->getFilesystem()) { $out .= '<div>'; $out .= '<img src="' . $filesystem->getIcon(50) . '"/> '; $out .= '</div>'; } return $out; }
function render() { $out = ''; if ($this->node->getChildren(true)) { foreach ($this->node->getChildren(true) as $child) { $content = $child->getContent(); $content->load(); $url = new url(); $url->set('node_id', $child->getId()); $out .= '<a href="' . $url->render() . '">' . $content->getTitle() . '</a> <br/>'; } return $out; } else { return false; } }
function render() { $out = ''; if ($siblings = $this->node->getSibling(true)) { foreach ($siblings as $child) { $content = $child->getContent(); if ($content->isUsedIn('navigation')) { $content->load(); $url = new url(); $url->set('node_id', $child->getId()); $out .= '<a href="' . $url->render() . '">' . $content->getTitle() . '</a> <br/>'; } } return $out; } else { return false; } }
function getMainMenu() { $out = ''; global $thinkedit; $node = $thinkedit->newNode(); $node->loadRootNode(); if ($node->getChildren()) { foreach ($node->getChildren() as $child) { $content = $child->getContent(); $content->load(); $url = new url(); $url->set('node_id', $child->getId()); $out[] = '<a href="' . $url->render() . '">' . $content->getTitle() . '</a>'; } return $out; } else { return false; } }
function render() { $out = ''; $url = new url(); $url->keepAll(); $out .= sprintf('<form action="%s" method="post">', $url->render()); if (is_array($this->record->field)) { foreach ($this->record->field as $field) { $out .= '<div class="input">'; $out .= $field->getHelp(); $out .= ' : '; $out .= '<br/>'; $out .= $field->renderUI(); $out .= '</div>'; } } else { trigger_error('form::render() no fields found in the record, cannot render form'); } $out .= sprintf('<input type="submit" value="%s" name="save"> ', translate('save_button')); $out .= sprintf('<input type="submit" value="%s" name="cancel">', translate('cancel_button')); $out .= '</form>'; return $out; }
foreach ($allowed_items as $allowed_item) { if ($allowed_item['class'] == 'record') { $table = $thinkedit->newTable($allowed_item['type']); $item['title'] = $table->getTitle(); $url = new url(); $url->set('mode', 'new_node'); $url->set('node_id', $current_node->getId()); $url->addObject($table); $item['action'] = $url->render('edit.php'); $out['allowed_items'][] = $item; } } } /******************** Global paste ****************************/ /* $url = new url(); $url->set('source_node', $current_node->getId()); $url->set('action', 'cut'); $out['clipboard']['cut_link'] = $url->render('clipboard.php'); */ if ($session->get('clipboard_source_node')) { $url = new url(); $url->set('target_node', $current_node->getId()); $url->set('action', 'paste'); $out['clipboard']['paste_link'] = $url->render('clipboard.php'); } debug($out, 'OUT'); // include template : include 'header.template.php'; include 'structure.template.php'; include 'footer.template.php';
} $relations = $relation->getRelations($source); if ($relations) { foreach ($relations as $relation_object) { $relation_object->load(); $item['title'] = te_short($relation_object->getTitle(), 50); $item['icon'] = $relation_object->getIcon(); $url->set('action', 'unrelate'); $url->addObject($relation_object, 'target_'); $item['remove_url'] = $url->render(); $out['relation']['data'][] = $item; } } $url = new url(); $url->set('mode', 'relation'); $out['browse_url'] = $url->render('browser.php'); debug($out, 'OUT'); debug($relations); $out['title'] = 'Relations'; // include template file include 'relation.template.php'; die; //$debug=true; // check/validate if we have enough input // check module name // todo : need validation (from config file)! if (!$_REQUEST['module']) { error(translate('please_choose_a_module')); } $module = $_REQUEST['module']; $out['module'] = $module;
$url = new url(); $url->keep('path'); $url->set('file_to_delete', $child->getPath()); $url->set('action', 'delete'); $file['delete_url'] = $url->render(); $out['files'][] = $file; } } // handle add folder // handle remove folder // handle sync with folder // define action buttons urls $url = new url(); $url->keep('path'); $url->set('action', 'add_folder'); $out['add_folder_url'] = $url->render(); $url = new url(); $url->keep('path'); $url->set('action', 'upload_file'); $out['upload_file_url'] = $url->render(); // add breadcrumb $url = new url(); $out['breadcrumb'][1]['title'] = translate('filemanager_title'); $out['breadcrumb'][1]['url'] = $url->render(); debug($out, 'OUT'); //print_a($out); // include template : include 'header.template.php'; include 'file_manager.template.php'; //include('list.template.php'); include 'footer.template.php';
$url->set('source_node', $node_item->getId()); $url->set('action', 'cut'); $node_info['clipboard']['cut_link'] = $url->render('clipboard.php'); $url = new url(); $url->set('source_node', $node_item->getId()); $url->set('action', 'copy'); $node_info['clipboard']['copy_link'] = $url->render('clipboard.php'); $url = new url(); $url->set('target_node', $node_item->getId()); $url->set('action', 'paste'); $node_info['clipboard']['paste_link'] = $url->render('clipboard.php'); /******* locales links ****/ if ($content->isMultilingual()) { $locales = $thinkedit->configuration->getLocaleList(); foreach ($locales as $locale) { $url = new url(); $url->set('node_id', $node_item->getId()); $content->setLocale($locale); $url->addObject($content); $url->set('mode', 'edit_node'); $node_info['locale'][$locale]['edit_url'] = $url->render('edit.php'); $node_info['locale'][$locale]['locale'] = $locale; } } /******* append this node info to out nodes list ****/ $out['nodes'][] = $node_info; $i++; } } require 'node.template.php'; //print_r ($out);
<?php require_once '../class/url.class.php'; require_once '../class/record.class.php'; require_once '../thinkedit.init.php'; $url = new url(); $url->setParam('id', 7); $url->setParam('action', 'move'); $url->setParam('locale', 'en'); $url->unSetParam('id'); echo '<pre>'; echo $url->render(); // try it with ./url.test.php?test_class=record&test_type=article&test_id=5 // and with url.test.php?test_class=record&test_type=article echo $url->getParam('test'); $record = new record('article'); $record->set('id', 5); $url->addObject($record, 'my_'); echo '<hr>'; echo $url->render(); $object = $url->getObject('test_'); $object->load(); echo '<hr>'; print_r($object);
$i++; } // ----------------------------- //handle pagination // ----------------------------- if ($record_count > 25) { // find number of pages $number_of_pages = intval($record_count / 25) + 1; for ($i = 0; $i < $number_of_pages; $i++) { $out['pagination'][$i]['title'] = $i + 1; $url = new url(); $url->keep('class'); $url->keep('type'); $url->keep('sort'); $url->set('page', $i); $out['pagination'][$i]['url'] = $url->render(); $url = new url(); if ($url->get('page') == $i) { $out['pagination'][$i]['current'] = true; } } //echo $number_of_pages; // create pages array } /* echo '<pre>'; print_r($out['pagination']); */ // ----------------------------- //handle global actions // -----------------------------
<!-- Cover --> <?php if (isset($sidebar_image)) { ?> <div id="cover"> <img src="<?php echo $sidebar_image->getThumbnail(array('w' => 170)); ?> "/> <?php // fabrication lien vers ecard $url = new url(); $url->set('image', $sidebar_image->getPath()); $url->set('template', '/ecards/' . te_get_section_name($node) . '.png'); $ecard_url = $url->render(ROOT_URL . '/plugin/ecards/'); ?> <a onclick="popup(this.href, 'ecard'); return false;" target="_blank" class="<?php echo te_get_section_name($node); ?> _sub" href="<?php echo $ecard_url; ?> "> <img src="<?php echo te_design(); ?> /sources/fleche.gif"> Envoyer cette image en carte postale </a>
function renderAsIcons() { $out = ''; if (isset($this->pager)) { $out .= $this->pager->render(); } // $out.='<table border="1">'; /* if (is_array($this->column)) { foreach ($this->column as $id=>$column) { $out.='<th>' . $column['title'] .'</th>'; } } else { trigger_error('datagrid::render() no column defined'); } if (is_array($this->local_action)) { $out.='<th>' . translate('datagrid_action_header') .'</th>'; } */ if (is_array($this->data)) { $i = 0; foreach ($this->data as $data) { $i++; if ($i >= count($this->data)) { $out .= '<table class="icon_table" style="float: none">'; } else { $out .= '<table class="icon_table" style="float: left">'; } $out .= '<tr>'; $out .= '<td>'; $out .= '<img src="decoration/types/folder.png">'; $out .= '</td>'; $out .= '</tr>'; $out .= '<tr>'; $out .= '<td>'; $out .= substr($data['title'], 0, 32); $out .= '<br/>'; // add local action buttons if (is_array($this->local_action)) { //$out .= '<td>'; foreach ($this->local_action as $action) { require_once ROOT . '/class/url.class.php'; $url = new url(); // find the primary columns to pass to the url foreach ($this->column as $id => $column) { if ($column['primary']) { $url->setParam($id, $data[$id]); } } $url->setFilename($action['url']); $out .= '<a href="' . $url->render() . '">' . $action['title'] . '</a> '; } } $out .= '</td>'; $out .= '</tr>'; $out .= '</table>'; foreach ($this->column as $id => $column) { // $out.='<td>' . substr($data[$id], 0, 32) .'</td>'; } } } else { translate('empty_datagrid'); } // add local action buttons if (is_array($this->global_action)) { foreach ($this->global_action as $action) { require_once ROOT . '/class/url.class.php'; $url = new url(); $url->setFilename($action['url']); require_once ROOT . '/class/button.class.php'; $button = new button($action['title'], $url->render()); $out .= $button->render(); } } return $out; }
function te_admin_toolbox() { global $te_admin_toolbox_written; if (!isset($te_admin_toolbox_written)) { $te_admin_toolbox_written = true; global $thinkedit; if ($thinkedit->user->isAdmin()) { $out = ''; // add jquery code $out = te_jquery(); // todo move style sheet somewhere, but this one is common to all designs, and designs author can do what they want with it // done, file is in /edit/toolbar.css $out .= '<link type="text/css" href="' . ROOT_URL . '/edit/ressource/css/toolbar.css" rel="stylesheet" media="screen"/>'; $out .= '<div class="te_tools">'; $out .= '<div class="te_toolbar">'; $out .= '<div class="te_toolbar_logo">'; $out .= '<b>ThinkEDIT</b>'; // todo add version number automagically $out .= '</div>'; // logout $url = $thinkedit->newUrl(); $out .= '<a href="' . ROOT_URL . '/edit/logout.php" class="te_toolbar_button">' . translate('logout') . '</a>'; // refresh page link $url = new url(); $url->keep('node_id'); $url->set('refresh', 1); $out .= '<a href="' . $url->render() . '" class="te_toolbar_button">' . translate('refresh_page') . '</a>'; // refresh site link $url = new url(); $url->keep('node_id'); $url->set('clear_cache', 1); $out .= '<a href="' . $url->render() . '" class="te_toolbar_button">' . translate('refresh_site') . '</a>'; // edit page link $url = new url(); $url->keep('node_id'); $out .= '<a href="' . $url->render('./edit/structure.php') . '" target="_blank" class="te_toolbar_button">' . translate('edit') . '</a>'; // show hide profiling $out .= '<a class="te_toolbar_button" onclick="$(\'.te_profiling\').toggle()">' . translate('toggle_profiling') . '</a>'; // show hide errors if (isset($thinkedit->errors)) { $out .= '<a class="te_toolbar_button te_toolbar_error_button" onclick="$(\'.te_error_log\').toggle()">' . translate('toggle_errors') . '</a>'; } $out .= '</div>'; // end of toolbar $out .= '<div class="te_profiling te_console" style="display: none">'; $out .= 'Total Queries : ' . $thinkedit->db->getTotalQueries(); $out .= '<br/>'; $out .= 'Total time : ' . $thinkedit->timer->render(); global $db_debug; if (isset($db_debug)) { if (!$thinkedit->isInProduction()) { foreach ($db_debug as $sql) { $out .= "<li>{$sql}</li>"; } } else { $out .= "<li>SQL not shown in production mode</li>"; } } $out .= '</div>'; // end of profiling // include error log $out .= te_error_log(); $out .= '</div>'; // end of tools return $out; } else { return false; } } }
$url = new url(); $url->set('node_id', $current_node->getId()); //$url->addObject($current_node, 'current_'); $out['structure_breadcrumb'][$i]['url'] = $url->render(); /************************ Allowed items ************************/ $allowed_items = $current_node->getAllowedItems(); if (is_array($allowed_items)) { foreach ($allowed_items as $allowed_item) { if ($allowed_item['class'] == 'record') { $table = $thinkedit->newTable($allowed_item['type']); $item['title'] = $table->getTitle(); $url = new url(); $url->set('mode', 'new_node'); $url->set('node_id', $current_node->getId()); $url->addObject($table); $item['action'] = $url->render('edit.php'); $out['allowed_items'][] = $item; } } } /* // first allow anything : $config_tool = $thinkedit->newConfig(); $tables = $config_tool->getTableList(); // generating the table list from the config array foreach($tables as $table_id) { $table = $thinkedit->newTable($table_id); $item['title'] = $table->getTitle();
$page->add($module->view()); $page->endPanel('test'); $page->startPanel('title'); $page->add('<h1>Welcome to Thinkedit 3.0</h1>'); $page->endPanel('title'); $page->addSeparator(); $page->startPanel('help'); $page->add('Navigate using icons bellow, use "up" to go up in the hierarchy'); $page->endPanel('help'); $page->addSeparator(); $page->startPanel('breadcrumb'); $parent = $module->getParent(); if ($parent) { $parent_link = new url(); $parent_link->setParam('node', $parent->getNode()); $page->add('<a href="' . $parent_link->render() . '">Up</a> '); } else { $page->add('You are at the root of this site'); } $page->endPanel('breadcrumb'); $page->addSeparator(); $browser->addAction('delete', 'effacer'); $browser->setGlobalAction('browse'); $childs = $module->getChild(); if ($childs) { foreach ($childs as $child) { $browser->addFolder($child); } } $page->startPanel('browser'); $page->add($browser->render());
/****************** Node Form items ******************/ if (isset($node)) { foreach ($node->record->field as $field) { if ($field->isUsedIn('edit')) { $out['node_field'][$field->getName()]['ui'] = $field->renderUi('node_'); if ($field->getType() != 'id') { $out['node_field'][$field->getName()]['title'] = $field->getTitle(); } else { $out['node_field'][$field->getName()]['title'] = ''; } $out['node_field'][$field->getName()]['help'] = $field->getHelp(); } } } /****************** Relations ******************/ $url = new url(); $url->addObject($record, 'source_'); $out['relation']['url'] = $url->render('relation.php'); // clean url $url = new url(); // describes the banner : $out['banner']['needed'] = true; $out['banner']['title'] = $record->getTitle(); //$out['banner']['message'] = $record->getHelp(); $out['banner']['image'] = $record->getIcon(); debug($out, 'OUT'); debug($_REQUEST, 'Request'); // include the templates include 'header.template.php'; include 'edit.template.php'; include 'footer.template.php';
// if we are in root if ($we_are_root) { $nodes[] = $current_node; } else { if ($current_node->hasChildren()) { $nodes = $current_node->getChildren(); } } if (isset($nodes) && is_array($nodes)) { $i = 0; foreach ($nodes as $node_item) { $content = $node_item->getContent(); $content->load(); $item['title'] = te_short($content->getTitle(), 40); $item['icon'] = $content->getIcon(); $url = new url(); $url->keep('class'); $url->keep('mode'); $url->set('node_id', $node_item->getId()); $item['visit_url'] = $url->render(); if ($mode == 'relation') { $url->addObject($node_item, 'target_'); $url->set('action', 'relate'); $item['url'] = $url->render('relation.php'); } $out['items'][] = $item; } } } debug($out, 'OUT'); include 'browser.template.php';
function te_admin_toolbox() { global $thinkedit; if ($thinkedit->user->isAdmin()) { $out = ''; // todo move style sheet somewhere, but this one is common to all designs, and designs author can what they want $out .= ' <style> .admin_toolbox { position: absolute; position: fixed; top: 1em; right: 1em; width: 8em; background-color : white; padding: 1em; } .admin_toolbox_button { background-color : #0080ff; /*margin: 5px;*/ padding: 5px; display: block; text-decoration: none; color: white; } </style> '; $out .= '<div class="admin_toolbox">'; $url = new url(); $url->keep('node_id'); $url->set('refresh', 1); $out .= '<br/>'; $out .= '<a href="' . $url->render() . '" class="admin_toolbox_button">' . te_translate('refresh') . '</a>'; $url = new url(); $url->keep('node_id'); $url->set('clear_cache', 1); $out .= '<br/>'; $out .= '<a href="' . $url->render() . '" class="admin_toolbox_button">' . te_translate('clear_cache') . '</a>'; $url = new url(); $url->keep('node_id'); $out .= '<br/>'; $out .= '<a href="' . $url->render('./edit/structure.php') . '" target="_blank" class="admin_toolbox_button">' . te_translate('edit') . '</a>'; $out .= '</div>'; $out .= 'Total Queries : ' . $thinkedit->db->getTotalQueries(); $out .= '<br/>'; $out .= 'Total time : ' . $thinkedit->timer->render(); global $db_debug; if (isset($db_debug)) { if (!$thinkedit->isInProduction()) { foreach ($db_debug as $sql) { $out .= "<li>{$sql}</li>"; } } else { $out .= "<li>SQL not shown in production mode</li>"; } } return $out; } else { return false; } }
$out['relation']['url'] = $url->render('relation.php'); // clean url $url = new url(); // generates the breadcrumb data //$out['breadcrumb'][0]['title'] = translate('home_link'); //$out['breadcrumb'][0]['url'] = 'main.php'; // if we are from a node form if ($url->get('mode') == 'edit_node' or $url->get('mode') == 'new_node') { $out['breadcrumb'][1]['title'] = translate('structure'); if ($parent = $node->getParent()) { $url->set('node_id', $parent->getId()); } else { $url->set('node_id', $node->getId()); // $url->keep('node_id'); } $out['breadcrumb'][1]['url'] = $url->render('structure.php'); } else { $out['breadcrumb'][1]['title'] = $table_object->getTitle(); $out['breadcrumb'][1]['url'] = $url->linkTo($table_object, 'list.php'); } $out['breadcrumb'][2]['title'] = translate('editing_link'); $out['breadcrumb'][2]['url'] = ''; // describes the banner : $out['banner']['needed'] = true; $out['banner']['title'] = $table_object->getTitle(); $out['banner']['message'] = $table_object->getHelp(); $out['banner']['image'] = $table_object->getIcon(); debug($out, 'OUT'); debug($_REQUEST, 'Request'); if ($url->get('save_and_return_to_list')) { $url->set('info', 'edit_successfull');