/** * get field value of an item for inplace editing */ function itemLoadField() { header("Content-type: text/html; charset=utf-8"); header("Expires: -1"); header("Cache-Control: post-check=0, pre-check=0"); header("Pragma: no-cache"); header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT"); if (!($item_id = get('item'))) { echo "Failure: could not get item_id"; return NULL; } if (!($item = DbProjectItem::getVisibleById($item_id))) { echo "Failure: could not get item #" . intval($item_id); return NULL; } if (!($object = DbProjectItem::getObjectById($item_id))) { echo "Failure: could not get object #" . intval($item_id); return NULL; } $field_name = 'description'; if (get('field')) { $field_name = asCleanString(get('field')); } if (!isset($object->fields[$field_name])) { return NULL; } require_once confGet('DIR_STREBER') . 'render/render_wiki.inc.php'; $chapter = intVal(get('chapter')); if (is_null($chapter)) { print $object->{$field_name}; } else { print getOneWikiChapter($object->{$field_name}, $chapter); } }
/** * Channels the view an item to correct page @ingroup pages * * This Page is required for SEF-Urls. With the ID it get the request Item from the database and depending * on its type it renders the appropriate view page. */ function itemView() { global $PH; if (!($id = intval(get('item')))) { $id = intval(get('id')); } if ($item = DbProjectItem::getVisibleById($id)) { switch ($item->type) { case ITEM_TASK: $PH->show('taskView', array('tsk' => $id)); return; case ITEM_FILE: $PH->show('fileView', array('file' => $id)); return; case ITEM_COMMENT: $PH->show('commentView', array('comment' => $id)); return; case ITEM_EFFORT: $PH->show('effortView', array('effort' => $id)); return; case ITEM_PERSON: $PH->show('personView', array('person' => $id)); return; case ITEM_PROJECT: $PH->show('projView', array('prj' => $id)); return; case ITEM_COMPANY: $PH->show('companyView', array('company' => $id)); return; default: $PH->abortWarning("Unknown item"); return; } } else { $PH->abortWarning("Unknown item"); } }
/** * tries to build a valid a href-link to an item. * * - uses $this->name * - sets -this-html * - does all the neccessary security checks, styles and conversions */ static function renderLinkFromItemId($target_id, $name = "") { global $PH; $target_id = intval($target_id); $html = ""; if (!($item = DbProjectItem::getVisibleById($target_id))) { $html = '<em>' . sprintf(__("Unkwown item %s"), $target_id) . '</em>'; } else { switch ($item->type) { case ITEM_TASK: if ($task = Task::getVisibleById($item->id)) { $style_isdone = $task->status >= STATUS_COMPLETED ? 'isDone' : ''; if ($name) { $html = $PH->getLink('taskView', $name, array('tsk' => $task->id), $style_isdone, true); } else { $html = $task->getLink(false); } } break; case ITEM_FILE: require_once confGet('DIR_STREBER') . "db/class_file.inc.php"; if ($file = File::getVisibleById($item->id)) { if ($name) { $html = $PH->getLink('fileDownloadAsImage', $name, array('file' => $file->id), NULL, true); } else { $html = $PH->getLink('fileDownloadAsImage', $file->name, array('file' => $file->id)); } } break; case ITEM_COMMENT: require_once confGet('DIR_STREBER') . "db/class_comment.inc.php"; if ($comment = Comment::getVisibleById($item->id)) { if ($name) { $html = $PH->getLink('commentView', $name, array('comment' => $comment->id), NULL, true); } else { $html = $PH->getLink('commentView', $comment->name, array('comment' => $comment->id)); } } break; case ITEM_PERSON: if ($person = Person::getVisibleById($item->id)) { if ($name) { $html = $PH->getLink('personView', $name, array('person' => $person->id), NULL, true); } else { $html = $PH->getLink('personView', $person->name, array('person' => $person->id)); } } break; case ITEM_PROJECT: if ($project = Project::getVisibleById($item->id)) { if ($name == "") { $name = asHtml($project->name); } $html = $PH->getLink('projView', $name, array('prj' => $project->id), NULL, true); } break; default: $html = '<em>' . sprintf(__('Cannot link to item #%s of type %s'), intval($target_id), $item->type) . '</em>'; break; } } return $html; }
public function print_automatic() { global $PH; global $auth; if (!($this->active_block_function = $this->getBlockStyleFromCookie())) { $this->active_block_function = 'list'; } $this->group_by = get("blockstyle_{$PH->cur_page->id}_{$this->id}_grouping"); #$this->initOrderQueryOption("created DESC"); $this->initOrderQueryOption(); $this->query_options['person'] = $auth->cur_user->id; $this->query_options['is_bookmark'] = 1; ### grouped view ### if ($this->active_block_function == 'grouped') { /** * @@@ later use only once... * * $this->columns= filterOptions($this->columns,"CURPAGE.BLOCKS[{$this->id}].STYLE[{$this->active_block_function}].COLUMNS"); */ if (isset($this->columns[$this->group_by])) { unset($this->columns[$this->group_by]); } #$this->query_options['order_by'] = ''; ### prepend key to sorting ### if (isset($this->query_options['order_by'])) { $this->query_options['order_by'] = $this->groupings->getActiveFromCookie() . "," . $this->query_options['order_by']; #$this->query_options['order_by'] = 'id'; } else { $this->query_options['order_by'] = $this->groupings->getActiveFromCookie(); #$this->query_options['order_by'] = 'id'; } } else { $pass = true; } $bookmark_items = ItemPerson::getAll($this->query_options); $items = array(); foreach ($bookmark_items as $bi) { if ($item = DbProjectItem::getVisibleById($bi->item)) { $items[] = $item; } } $this->render_list($items); }
private function addUntouchedMonitoredItems() { $unchanged_headline_html = ''; $unchanged_headline_txt = ''; $unchanged_body_html = ''; $unchanged_body_plaintext = ''; $monitored_items_unchanged = ItemPerson::getAll(array('is_bookmark' => 1, 'notify_if_unchanged_min' => NOTIFY_1DAY, 'person' => $this->recipient->id)); if (!$monitored_items_unchanged) { return; } foreach ($monitored_items_unchanged as $miu) { ## reminder period ## $period = ''; switch ($miu->notify_if_unchanged) { case NOTIFY_1DAY: $period = 24 * 60 * 60; break; case NOTIFY_2DAYS: $period = 2 * 24 * 60 * 60; break; case NOTIFY_3DAYS: $period = 3 * 24 * 60 * 60; break; case NOTIFY_4DAYS: $period = 4 * 24 * 60 * 60; break; case NOTIFY_5DAYS: $period = 5 * 24 * 60 * 60; break; case NOTIFY_1WEEK: $period = 7 * 24 * 60 * 60; break; case NOTIFY_2WEEKS: $period = 2 * 7 * 24 * 60 * 60; break; case NOTIFY_3WEEKS: $period = 3 * 7 * 24 * 60 * 60; break; case NOTIFY_1MONTH: $period = 4 * 7 * 24 * 60 * 60; break; case NOTIFY_2MONTH: $period = 2 * 4 * 7 * 24 * 60 * 60; break; } $date = $miu->notify_date; if ($pi = DbProjectItem::getVisibleById($miu->item)) { $mod_date = $pi->modified; if ($date != '0000-00-00 00:00:00') { $date = strToGMTime($date) + $period; $date = date('Y-m-d H:i:s', $date); if ($date >= $mod_date && strToGMTime($date) <= time()) { $diff = strToGMTime($date) - strToGMTime($mod_date); if ($diff >= $period) { ### diff in days ### $information_count++; $days = round((time() - strToGMTime($miu->notify_date)) / 60 / 60 / 24); $object = DbProjectItem::getObjectById($pi->id); $unchanged_body_html .= '<li>' . sprintf(__("%s (not touched since %s day(s))"), asHtml($object->name), $days) . '</li>'; $unchanged_body_plaintext .= '- ' . sprintf(__("%s (not touched since %s day(s))"), $object->name, $days) . '\\n\\r'; } } } } } if ($unchanged_body_html) { $this->information_count++; $this->body_html .= "<h3>" . __('Unchanged monitored items:', 'notification') . "</h3>" . "<ul>" . $unchanged_body_html . "</ul>"; $this->body_plaintext .= "\n\r" . __('Unchanged monitored items:', 'notification') . "\n\r" . $unchanged_body_plaintext; } }
function render_tr(&$file, $style = "") { global $PH; if (!isset($file) || !$file instanceof File) { return; } require_once confGet('DIR_STREBER') . 'render/render_wiki.inc.php'; $buffer = '<b>'; $buffer .= $PH->getLink('fileDownload', $file->name, array('file' => $file->id)); $buffer .= '</b>' . '<br />'; ### name ### #$buffer = '<b>' # . $PH->getLink('fileView',$file->name, array('file'=>$file->id),'item file') # .'</b>' # . '<br>'; ### parent task ### $diz_buffer = ""; if ($file->parent_item && ($item = DbProjectItem::getVisibleById($file->parent_item))) { if ($item->type == ITEM_TASK) { if ($task = Task::getVisibleById($file->parent_item)) { $tmp = $task->getFolderLinks(); if ($tmp) { $tmp = $tmp . ">"; } $diz_buffer .= __("in", "... folder") . ": " . $tmp . $task->getLink(false) . "<br/>"; } } } ### details ### $diz_buffer .= $file->filesize . " bytes" . ' / ' . asHtml($file->mimetype) . ' / ' . sprintf(__("ID %s"), $file->id) . ' / ' . "<span class=sub>" . $PH->getLink('fileView', __('Show Details'), array('file' => $file->id)) . "</span>" . "<br/>"; ### description ### $diz_buffer .= wikifieldAsHtml($file, 'description'); if ($diz_buffer) { $buffer .= '<span class=sub>' . $diz_buffer . "</span>"; } echo '<td>' . $buffer . '</td>'; #$str= $PH->getLink('fileView',$obj->name, array('file'=>$obj->id),'item file'); #print "<td>$str</td>"; }