Commit a7d55c5f authored by lrargerich's avatar lrargerich

Stuff

parent 395ec5ef
......@@ -1495,7 +1495,6 @@ tiki/templates/tiki-list_surveys.tpl -text
tiki/templates/tiki-list_trackers.tpl -text
tiki/templates/tiki-listpages.tpl -text
tiki/templates/tiki-login.tpl -text
tiki/templates/tiki-minical.php -text
tiki/templates/tiki-minical.tpl -text
tiki/templates/tiki-my_tiki.tpl -text
tiki/templates/tiki-mytiki_bar.tpl -text
......
......@@ -8,18 +8,9 @@
*/
function smarty_resource_style_source($tpl_name, &$tpl_source, &$smarty)
{
// do database call here to fetch your template,
// populating $tpl_source
$sql = new SQL;
$sql->query("select tpl_source
from my_table
where tpl_name='$tpl_name'");
if ($sql->num_rows) {
$tpl_source = $sql->record['tpl_source'];
return true;
} else {
return false;
}
// Check if file exists in the style directory if not
// check if file exists in the templates directory,
// if not then fall
}
function smarty_resource_style_timestamp($tpl_name, &$tpl_timestamp, &$smarty)
......
## THIS FILE IS JUST A HELP FOR DEVELOPERS IT SHOULDNT BE USED IN A 1.5 DISTRIBUTION
drop table if exists tiki_minical;
create table tiki_minical_events(
user varchar(200),
eventId integer(12) not null auto_increment,
title varchar(250),
description text,
start integer(14),
duration integer(3),
primary key(eventId)
);
INSERT INTO users_permissions(permName,type,permDesc,level) VALUES ('tiki_p_usermenu','user','Can create items in personal menu','registered');
INSERT INTO users_permissions(permName,type,permDesc,level) VALUES ('tiki_p_minical','user','Can use the mini event calendar','registered');
......
<?php
class MiniCalLib extends TikiLib {
function MiniCalLib($db)
{
# this is probably uneeded now
if(!$db) {
die("Invalid db object passed to MiniCalLib constructor");
}
$this->db = $db;
}
// Returns an array where each member of the array has:
// start: unix timestamp of the interval start time
// end : unix timestamp of the interval end time
// events : array of events for the slot listing:
// title, description and duration
function minical_events_by_slot($user,$start,$end,$interval)
{
// since interval is in hour convert it to seconds
$interval = $interval * 60 * 60;
$slots = Array();
while($start<=$end) {
$aux=Array();
$aux['start']=$start;
$end_p = $start+$interval;
$aux['end']=$end_p;
$query = "select * from tiki_minical_events where user='$user' and start>=$start and start<$end_p";
//print($query);print("<br/>");
$result = $this->query($query);
$events=Array();
while($res = $result->fetchRow(DB_FETCHMODE_ASSOC)) {
$events[] = $res;
}
$aux['events']=$events;
$slots[]=$aux;
$start+= $interval;
}
return $slots;
}
function minical_list_events($user,$offset,$maxRecords,$sort_mode,$find)
{
$sort_mode = str_replace("_desc"," desc",$sort_mode);
$sort_mode = str_replace("_asc"," asc",$sort_mode);
if($find) {
$mid=" and (name like '%".$find."%' or url like '%".$find."%')";
} else {
$mid=" ";
}
$query = "select * from tiki_minical_events where
user='$user' $mid order by $sort_mode limit $offset,$maxRecords";
$query_cant = "select count(*) from tiki_minical_events where
user='$user' $mid";
$result = $this->query($query);
$cant = $this->getOne($query_cant);
$ret = Array();
while($res = $result->fetchRow(DB_FETCHMODE_ASSOC)) {
$ret[] = $res;
}
$retval = Array();
$retval["data"] = $ret;
$retval["cant"] = $cant;
return $retval;
}
function minical_get_event($user,$eventId)
{
$query = "select * from tiki_minical_events where
user='$user' and eventId='$eventId'";
$result = $this->query($query);
$res = $result->fetchRow(DB_FETCHMODE_ASSOC);
return $res;
}
function minical_replace_event($user,$eventId,$title,$description,$start,$duration)
{
$title = addslashes($title);
$description = addslashes($description);
$now = date("U");
if($eventId) {
$query = "update tiki_minical_events set
title='$title', description='$description',start=$start,duration=$duration
where user='$user' and
eventId=$eventId";
$this->query($query);
return $eventId;
} else {
$query = "insert into tiki_minical_events(user,title,description,start,duration)
values('$user','$title','$description',$start,$duration)";
$this->query($query);
$Id = $this->getOne("select max(eventId) from
tiki_minical_events where user='$user' and start=$start");
return $Id;
}
}
function minical_remove_event($user,$eventId)
{
$query = "delete from tiki_minical_events where user='$user'
and eventId=$eventId";
$this->query($query);
}
}
$minicallib= new MiniCalLib($dbTiki);
?>
......@@ -4667,4 +4667,4 @@ function httpPrefix() {
}
?>
?>
\ No newline at end of file
......@@ -67,8 +67,7 @@ if(isset($_REQUEST['send'])) {
// Remove invalid users from the to, cc and bcc fields
$users = Array();
foreach($all_users['data'] as $a_user) {
$a_user = $a_user['user'];
foreach($all_users as $a_user) {
if(!empty($a_user)) {
if($messulib->user_exists($a_user)) {
if($messulib->get_user_preference($a_user,'allowMsgs','y')) {
......
{*Smarty template*}
<a class="pagetitle" href="tiki-minical.php">{tr}Mini Calendar{/tr}</a><br/><br/>
{include file=tiki-mytiki_bar.tpl}
<br/>
{cycle values="odd,even" print=false}
<table clas="normal" width="97%" >
{section name=ix loop=$slots}
<tr>
<td class="{cycle}">
<table>
<tr>
<td>
{$slots[ix].start|tiki_short_time}<!--<br/>{$slots[ix].end|tiki_short_time}-->
</td>
<td>
{section name=jj loop=$slots[ix].events}
{$slots[ix].events[jj].title}<br/>
{/section}
</td>
</tr>
</table>
</td>
</tr>
{/section}
</table>
<h3>{tr}Add an event{/tr}</h3>
<form action="tiki-minical.php" method="post">
<input type="hidden" name="eventId" value="{$eventId}" />
<input type="hidden" name="duration" value="2" />
<input type="hidden" name="description" value="dummy" />
<table class="normal">
<tr><td class="formcolor">{tr}Title{/tr}</td>
<td class="formcolor"><input type="text" name="title" value="{$info.title}" /></td>
</tr>
<tr>
<td class="formcolor">{tr}Start{/tr}</td>
<td class="formcolor">
{html_select_time time=$pdate_h display_seconds=false use_24_hours=true}
</td>
</tr>
<tr>
<td class="formcolor">&nbsp;</td>
<td class="formcolor"><input type="submit" name="save" value="{tr}save{/tr}" /></td>
</tr>
</table>
</form>
......@@ -9,7 +9,7 @@
<tr>
<td>
<table border='0' height='20' cellpadding='0' cellspacing='0'
width='200' style='background-color:white;'>
width='200' style='background-color:#666666;'>
<tr>
<td style='background-color:red;' width='{$cellsize}'>&nbsp;</td>
<td>&nbsp;</td>
......@@ -25,7 +25,7 @@
<small>{tr}quota{/tr}</small>
</td>
</tr>
</table>
</table>
</div>
<form action="tiki-userfiles.php" method="post">
......
<?php
function file_get_contents($file) {
$data = '';
$fp = fopen($file,'r');
while(!feof($fp)) {
$data .= fread($fp,4096);
}
fclose($fp);
return $data;
}
class ParseDataTest extends PHPUnit_TestCase {
// contains the object handle of the string class
var $t;
......@@ -20,7 +31,7 @@ class ParseDataTest extends PHPUnit_TestCase {
// delete your instance
unset($this->t);
}
// test the toString function
function test1() {
$input = file_get_contents('tests/parse_data/test1');
$result = $this->t->parse_data($input);
......
<ul><li> Item 1 </li><li> Item 2 </li><ul><li> Item 21 </li><li> Item 22 </li><ul><li> Item 221 </li><li> Item 222 </li></ul><li> Item 23 </li></ul><li> Item 3 </li></ul> <ol><li> Item 1 </li><li> Item 2 </li><ol><li> Item 21 </li><li> Item 22 </li><ol><li> Item 221 </li><li> Item 222 </li></ol><li> Item 23 </li></ol><li> Item 3 </li></ol> <dl><dt>foo1</dt><dd>definition1 </dd></dl><br/><dl><dt>foo2</dt><dd>definition2 </dd></dl><br/><br/>
\ No newline at end of file
<ul><li> Item 1</li><li> Item 2</li><ul><li> Item 21</li><li> Item 22</li><ul><li> Item 221</li><li> Item 222</li></ul><li> Item 23</li></ul><li> Item 3</li></ul><ol><li> Item 1</li><li> Item 2</li><ol><li> Item 21</li><li> Item 22</li><ol><li> Item 221</li><li> Item 222</li></ol><li> Item 23</li></ol><li> Item 3</li></ol><dl><dt>foo1</dt><dd>definition1</dd></dl><br/><dl><dt>foo2</dt><dd>definition2</dd></dl><br/><br/>
\ No newline at end of file
<i><b>Hola mundo</b></i><br/>
\ No newline at end of file
<i><b>Hola mundo</b></i><br/><table class="wikitable" border="1"><tr><td>r1c1</td><td>r1c2</td><td>r1c3</td></tr><tr><td>r2c1</td><td>r2c2</td><td>r2c3</td></tr></table><br/><table class="wikitable" border="1"><tr><td>r1c1</td><td>r1c2</td><td>r1c3</td></tr><tr><td><b>r2c1</b></td><td>r2c2</td><td>r2c3</td></tr></table><br/>description<a href='tiki-editpage.php?page=<b>test</b>+a+name' class='wiki'>?</a><br/>This is not converted<br/><a class='wiki' href='http://www.yahoo.com/'>cosa</a><br/>TestThisIsTheNameOfATestPageTest<a href='tiki-editpage.php?page=TestThisIsTheNameOfATestPageTest' class='wiki'>?</a><br/><div class='simplebox' align='center'>Some box</div><br/><div class='titlebar'>Some title</div><br/><br/><br/>
\ No newline at end of file
This is linking tests <br/><a class='wiki' href='http://www.google.com'>google</a> <br/>A link to a wiki page<a href='tiki-editpage.php?page=A link to a wiki page' class='wiki'>?</a> <br/>Not a link <br/>with a description<a href='tiki-editpage.php?page=Test2_Link' class='wiki'>?</a> <br/>TestSmashedWordsMakeALink<a href='tiki-editpage.php?page=TestSmashedWordsMakeALink' class='wiki'>?</a><br/>
\ No newline at end of file
This is linking tests<br/><a class='wiki' href='http://www.google.com'>google</a><br/>A link to a wiki page<a href='tiki-editpage.php?page=A link to a wiki page' class='wiki'>?</a><br/>Not a link<br/>with a description<a href='tiki-editpage.php?page=Test2_Link' class='wiki'>?</a><br/>TestSmashedWordsMakeALink<a href='tiki-editpage.php?page=TestSmashedWordsMakeALink' class='wiki'>?</a><br/>
\ No newline at end of file
<i><b>Hello world</b></i> <br/>Tis is a test <br/><b><i>Hi again</i></b><br/>
\ No newline at end of file
<i><b>Hello world</b></i><br/>Tis is a test<br/><b><i>Hi again</i></b><br/>
\ No newline at end of file
<?php
require_once('tiki-setup.php');
include_once('lib/minical/minicallib.php');
if($feature_minical != 'y') {
$smarty->assign('msg',tra("This feature is disabled"));
$smarty->display("styles/$style_base/error.tpl");
die;
}
if(!$user) {
$smarty->assign('msg',tra("Must be logged to use this feature"));
$smarty->display("styles/$style_base/error.tpl");
die;
}
//if($tiki_p_usermenu != 'y') {
// $smarty->assign('msg',tra("Permission denied to use this feature"));
// $smarty->display("styles/$style_base/error.tpl");
// die;
//}
if(!isset($_REQUEST["eventId"])) $_REQUEST["eventId"]=0;
if(isset($_REQUEST['remove'])) {
// foreach(array_keys($_REQUEST["menu"]) as $men) {
$minicallib->minical_remove_event($user, $_REQUEST['remove']);
// }
}
if(isset($_SESSION['thedate'])) {
$pdate = mktime(0,0,0,date("m",$_SESSION['thedate']),date("d",$_SESSION['thedate']),date("Y",$_SESSION['thedate']));
} else {
$pdate = date("U");
}
$pdate_h = mktime(date("G"),date("i"),date("s"),date("m",$pdate),date("d",$pdate),date("Y",$pdate));
$smarty->assign('pdate',$pdate);
$smarty->assign('pdate_h',$pdate_h);
if($_REQUEST["eventId"]) {
$info = $minicallib->minical_get_event($user,$_REQUEST["eventId"]);
} else {
$info=Array();
$info['title']='';
$info['description']='';
$info['start']=mktime(date("H"),date("i"),date("s"),date("m",$pdate),date("d",$pdate),date("Y",$pdate));
$info['duration']=1;
}
if(isset($_REQUEST['save'])) {
$start = mktime($_REQUEST['Time_Hour'],$_REQUEST['Time_Minute'],0,date("m",$pdate),date("d",$pdate),date("Y",$pdate));
$minicallib->minical_replace_event($user,$_REQUEST["eventId"],$_REQUEST["title"],$_REQUEST["description"],$start,$_REQUEST['duration']);
$info=Array();
$info['title']='';
$info['description']='';
$info['start']=mktime(date("h"),date("i"),date("s"),date("m",$pdate),date("d",$pdate),date("Y",$pdate));
$info['duration']=1;
$_REQUEST["eventId"]=0;
}
$smarty->assign('eventId',$_REQUEST["eventId"]);
$smarty->assign('info',$info);
$slot_start = $pdate + 60*60*9;
$slot_end = $pdate + 60*60*20;
$smarty->assign('slot_start',$slot_start);
$smarty->assign('slot_end',$slot_end);
$events = $minicallib->minical_events_by_slot($user,$slot_start,$slot_end,1);
//print_r($events);
$smarty->assign_by_ref('slots',$events);
include_once('tiki-mytiki_shared.php');
$smarty->assign('mid','tiki-minical.tpl');
$smarty->display("styles/$style_base/tiki.tpl");
?>
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment