2017-03-16 04:26:28 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace Zotlabs\Widget;
|
|
|
|
|
2019-06-30 02:23:31 +00:00
|
|
|
use Zotlabs\Lib\Apps;
|
|
|
|
|
2017-03-16 04:26:28 +00:00
|
|
|
require_once('include/event.php');
|
|
|
|
|
|
|
|
class Tasklist {
|
|
|
|
|
|
|
|
function widget($arr) {
|
|
|
|
|
2019-06-30 02:23:31 +00:00
|
|
|
if(! ( local_channel() && Apps::system_app_installed(local_channel(),'Tasks'))) {
|
|
|
|
return EMPTY_STR;
|
|
|
|
}
|
2017-03-16 04:26:28 +00:00
|
|
|
|
|
|
|
$o .= '<script>var tasksShowAll = 0; $(document).ready(function() { tasksFetch(); $("#tasklist-new-form").submit(function(event) { event.preventDefault(); $.post( "tasks/new", $("#tasklist-new-form").serialize(), function(data) { tasksFetch(); $("#tasklist-new-summary").val(""); } ); return false; } )});</script>';
|
|
|
|
$o .= '<script>function taskComplete(id) { $.post("tasks/complete/"+id, function(data) { tasksFetch();}); }
|
|
|
|
function tasksFetch() {
|
|
|
|
$.get("tasks/fetch" + ((tasksShowAll) ? "/all" : ""), function(data) {
|
|
|
|
$(".tasklist-tasks").html(data.html);
|
|
|
|
});
|
|
|
|
}
|
|
|
|
</script>';
|
|
|
|
|
|
|
|
$o .= '<div class="widget">' . '<h3>' . t('Tasks') . '</h3><div class="tasklist-tasks">';
|
2018-04-30 07:13:26 +00:00
|
|
|
$o .= '</div><form id="tasklist-new-form" action="" ><input class="form-control" id="tasklist-new-summary" type="text" name="summary" value="" /></form>';
|
2017-03-16 04:26:28 +00:00
|
|
|
$o .= '</div>';
|
|
|
|
return $o;
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|