parent
b89edaceb6
commit
c0a345f75a
@ -1,8 +0,0 @@ |
||||
<IfModule mod_rewrite.c> |
||||
Options -MultiViews |
||||
|
||||
RewriteEngine On |
||||
#RewriteBase /path/to/app |
||||
RewriteCond %{REQUEST_FILENAME} !-f |
||||
RewriteRule ^ index.php [L] |
||||
</IfModule> |
@ -1,87 +0,0 @@ |
||||
<?php |
||||
|
||||
require_once '../inc/global.inc.php'; |
||||
|
||||
use Silex\Application; |
||||
use Symfony\Component\HttpFoundation\Response; |
||||
use ChamiloLMSCoreBundle:CTimeline; |
||||
|
||||
class TimeLineController { |
||||
|
||||
function indexAction(Application $app) { |
||||
$timeline_query = $app['orm.em']->getRepository('ChamiloLMSCoreBundle:CTimeline')->findAll(); |
||||
$timeline_query = $app['orm.em']->createQuery('SELECT a FROM ChamiloLMSCoreBundle:CTimeline a'); |
||||
|
||||
$paginator = new Doctrine\ORM\Tools\Pagination\Paginator($timeline_query, $fetchJoinCollection = true); |
||||
$c = count($paginator); |
||||
$test = null; |
||||
foreach ($paginator as $item) { |
||||
$test .= $item->getHeadline() . "\n"; |
||||
} |
||||
$response = $test; |
||||
return new Response($response, 200, array()); |
||||
} |
||||
|
||||
function addAction(Application $app) { |
||||
$timeline = new Timeline(); |
||||
$url = $app['url_generator']->generate('add'); |
||||
$form = $timeline->return_item_form($url, 'edit'); |
||||
|
||||
// The validation or display |
||||
if ($form->validate()) { |
||||
$values = $form->exportValues(); |
||||
$values['type'] = 0; |
||||
$values['status'] = 0; |
||||
|
||||
$my_timeline = new CTimeline(); |
||||
$my_timeline->setCId(api_get_course_int_id()); |
||||
$my_timeline->setHeadline($values['headline']); |
||||
$my_timeline->setType($values['type']); |
||||
$my_timeline->setStartDate($values['start_date']); |
||||
$my_timeline->setEndDate($values['end_date']); |
||||
$my_timeline->setText($values['text']); |
||||
$my_timeline->setMedia($values['media']); |
||||
$my_timeline->setMediaCredit($values['media_credit']); |
||||
$my_timeline->setMediaCaption($values['media_caption']); |
||||
$my_timeline->setTitleSlide($values['title_slide']); |
||||
$my_timeline->setParentId($values['parent_id']); |
||||
$my_timeline->setStatus($values['status']); |
||||
|
||||
$app['orm.em']->persist($my_timeline); |
||||
$app['orm.em']->flush(); |
||||
|
||||
$message = Display::return_message(sprintf(get_lang('ItemUpdated'), $values['name']), 'confirmation'); |
||||
//$app['session']->setFlash('error', $message); |
||||
|
||||
return $app->redirect($app['url_generator']->generate('view', array('id'=> $my_timeline->getId())), 201); |
||||
} else { |
||||
$actions = '<a href="'.$app['url_generator']->generate('index').'">'.Display::return_icon('back.png',get_lang('Back'),'',ICON_SIZE_MEDIUM).'</a>'; |
||||
$content = $form->return_form(); |
||||
} |
||||
$app['template']->assign('content', $content); |
||||
$response = $app['template']->render_layout('layout_1_col.tpl'); |
||||
return new Response($response, 200, array()); |
||||
} |
||||
|
||||
function viewAction(Application $app, $id) { |
||||
$timeline = $app['db.orm.em']->find('CTimeline', $id); |
||||
$app['template']->assign('timeline', $timeline); |
||||
$response = $app['template']->render_template('timeline/view.tpl'); |
||||
return new Response($response, 200, array()); |
||||
} |
||||
|
||||
function editAction(Application $app, $id) { |
||||
$timeline = $app['db.orm.em']->find('CTimeline', $id); |
||||
$app['template']->assign('timeline', $timeline); |
||||
$content = $app['template']->fetch('default/timeline/edit.tpl'); |
||||
$app['template']->assign('content', $content); |
||||
$response = $app['template']->render_layout('layout_1_col.tpl'); |
||||
return new Response($response, 200, array()); |
||||
} |
||||
} |
||||
|
||||
$app->get('/', 'TimeLineController::indexAction')->bind('index'); |
||||
$app->get('/view/{id}', 'TimeLineController::viewAction')->bind('view'); |
||||
$app->get('/edit/{id}', 'TimeLineController::editAction')->bind('edit'); |
||||
$app->match('/add', 'TimeLineController::addAction', 'GET|POST')->bind('add'); |
||||
$app->run(); |
@ -1,18 +0,0 @@ |
||||
-- Insert this in your Chamilo 1.9 Database |
||||
|
||||
CREATE TABLE c_timeline ( |
||||
id INTEGER NOT NULL AUTO_INCREMENT, |
||||
c_id INTEGER NOT NULL, |
||||
headline VARCHAR(255) NOT NULL, |
||||
type VARCHAR(255) NOT NULL, |
||||
start_date VARCHAR(255) NOT NULL, |
||||
end_date VARCHAR(255) NOT NULL, |
||||
text VARCHAR(255) NOT NULL, |
||||
media VARCHAR(255) NOT NULL, |
||||
media_credit VARCHAR(255) NOT NULL, |
||||
media_caption VARCHAR(255) NOT NULL, |
||||
title_slide VARCHAR(255) NOT NULL, |
||||
parent_id INTEGER DEFAULT 0 NOT NULL, |
||||
status INTEGER NOT NULL, |
||||
PRIMARY KEY (id, c_id) |
||||
); |
@ -1,40 +0,0 @@ |
||||
<?php |
||||
/* For licensing terms, see /license.txt */ |
||||
/** |
||||
@author Julio Montoya <gugli100@gmail.com> BeezNest 2011 |
||||
* @package chamilo.timeline |
||||
*/ |
||||
|
||||
// name of the language file that needs to be included |
||||
$language_file = array ('registration','admin'); |
||||
require_once '../inc/global.inc.php'; |
||||
|
||||
$interbreadcrumb[]=array('url' => 'index.php','name' => get_lang('Timeline')); |
||||
$interbreadcrumb[]=array('url' => 'index.php','name' => get_lang('Listing')); |
||||
|
||||
$timeline = new Timeline(); |
||||
if (empty($_GET['id'])) { |
||||
api_not_allowed(); |
||||
} |
||||
$url = $timeline->get_url($_GET['id']); |
||||
$item = $timeline->get($_GET['id']); |
||||
$interbreadcrumb[]=array('url' => '#','name' => $item['headline']); |
||||
|
||||
$htmlHeadXtra[] = api_get_css(api_get_path(WEB_LIBRARY_JS_PATH).'timeline/timeline.css'); |
||||
$htmlHeadXtra[] = api_get_js('timeline/timeline-min.js'); |
||||
$htmlHeadXtra[] = ' |
||||
<script> |
||||
$(document).ready(function() { |
||||
var timeline = new VMM.Timeline(); |
||||
timeline.init("'.$url.'"); |
||||
}); |
||||
</script>'; |
||||
$content = '<div class="timeline-example"><div id="timeline"></div></div>'; |
||||
|
||||
$app['title'] = $tool_name; |
||||
$tpl = $app['template']; |
||||
|
||||
$tpl->assign('actions', $actions); |
||||
$tpl->assign('message', $message); |
||||
$tpl->assign('content', $content); |
||||
$tpl->display_one_col_template(); |
Loading…
Reference in new issue