'.$data;
$renderer->tablecell_close();
$renderer->tablerow_close();
}
/**
* Loads the helper plugin and gets task data for current ID
*/
function _loadHelper() {
global $ID;
$this->my =& plugin_load('helper', 'task');
if (!is_object($this->my)) return false;
$this->task = $this->my->readTask($ID);
return $true;
}
/**
* Returns the status cell contents
*/
function _getStatus($user, &$status) {
global $INFO;
$ret = '';
$status = $this->task['status'];
$responsible = $this->my->_isResponsible($user);
if ($INFO['perm'] == AUTH_ADMIN) {
$ret = $this->_statusMenu(array(-1, 0, 1, 2, 3, 4), $status);
} elseif ($responsible) {
if ($status < 3) $ret = $this->_statusMenu(array(-1, 0, 1, 2, 3), $status);
} else {
if ($status == 0) {
$ret = $this->_statusMenu(array(0, 1), $status);
} elseif ($status == 3) {
$ret = $this->_statusMenu(array(2, 3, 4), $status);
}
}
if (!$ret && $this->my) $ret = $this->my->statusLabel($status);
return ''. $ret .'';
}
/**
* Returns the XHTML for the status drop down list.
* Just forwards call to the old or new function.
*/
function _statusMenu($options, $status) {
if (class_exists('dokuwiki\Form\Form')) {
return $this->_statusMenuNew($options, $status);
} else {
return $this->_statusMenuOld($options, $status);
}
}
/**
* Returns the XHTML for the status popup menu.
* This is the new version using class dokuwiki\Form\Form.
*
* @see _statusMenu
*/
function _statusMenuNew($options, $status) {
global $ID, $lang;
$form = new dokuwiki\Form\Form(array('id' => 'task__changetask_form'));
$pos = 1;
$form->addHTML('
', $pos++);
// Set hidden fields
$form->setHiddenField ('id', $ID);
$form->setHiddenField ('do', 'changetask');
// Select status from drop down list
$dropDownOptions = array();
$selected = NULL;
$value = 0;
foreach ($options as $option) {
if ($status == $option) {
$selected = $option.' ';
}
$dropDownOptions [$option.' '] = $this->my->statusLabel($option);
}
$input = $form->addDropdown('status', $dropDownOptions, NULL, $pos++);
$input->val($selected);
// Add button
$form->addButton(NULL, $this->getLang('btn_change'), $pos++);
$form->addHTML('
', $pos++);
return $form->toHTML();
}
/**
* Returns the XHTML for the status popup menu.
* Old function generating all HTML on its own.
*
* @see _statusMenu
*/
function _statusMenuOld($options, $status) {
global $ID;
global $lang;
$ret = ''.DOKU_LF;
return $ret;
}
/**
* Returns the download link for the iCal file
*/
function _icsDownload() {
global $ID;
global $INFO;
$uid = hsc($ID.'@'.$_SERVER['SERVER_NAME']);
$title = hsc($INFO['meta']['title']);
$link = DOKU_BASE.'lib/plugins/task/ics.php?id='.$ID;
$src = DOKU_BASE.'lib/plugins/task/images/ics.gif';
$out = ''
. ''
. ' ';
return $out;
}
/**
* Returns the organizer in hCalendar format as hCard
*/
function _hCalUser($user) {
return '' . hsc($user) . '';
}
/**
* Returns the date in hCalendar format
*/
function _hCalDate($date) {
global $conf;
// strip time from preferred date format
$onlydate = preg_replace('#%[HIMprRST]|:#', '', ($conf['dformat']));
return '' . strftime($onlydate, $date) . '';
}
}
// vim:ts=4:sw=4:et:enc=utf-8: