コード例 #1
0
ファイル: FileSource.php プロジェクト: rjsmelo/tiki
 function getDocument($objectId, Search_Type_Factory_Interface $typeFactory)
 {
     $filegallib = Tikilib::lib('filegal');
     $file = $filegallib->get_file_info($objectId, true, false);
     $data = array('title' => $typeFactory->sortable(empty($file['name']) ? $file['filename'] : $file['name']), 'language' => $typeFactory->identifier('unknown'), 'creation_date' => $typeFactory->timestamp($file['created']), 'modification_date' => $typeFactory->timestamp($file['lastModif']), 'contributors' => $typeFactory->multivalue(array_unique(array($file['author'], $file['user'], $file['lastModifUser']))), 'description' => $typeFactory->plaintext($file['description']), 'filename' => $typeFactory->identifier($file['filename']), 'filetype' => $typeFactory->sortable(preg_replace('/^([\\w-]+)\\/([\\w-]+).*$/', '$1/$2', $file['filetype'])), 'filesize' => $typeFactory->plaintext($file['filesize']), 'gallery_id' => $typeFactory->identifier($file['galleryId']), 'file_comment' => $typeFactory->plaintext($file['comment']), 'file_content' => $typeFactory->plaintext($file['search_data']), 'parent_object_type' => $typeFactory->identifier('file gallery'), 'parent_object_id' => $typeFactory->identifier($file['galleryId']), 'parent_view_permission' => $typeFactory->identifier('tiki_p_download_files'));
     return $data;
 }
コード例 #2
0
ファイル: wikiplugin_friend.php プロジェクト: rjsmelo/tiki
function wikiplugin_friend($data, $params)
{
    extract($params, EXTR_SKIP);
    global $user;
    if (empty($other_user)) {
        return;
    }
    if (empty($add_button_text)) {
        $add_button_text = tra("Add to Friend Network");
    }
    if (empty($remove_button_text)) {
        $remove_button_text = tra("Remove from Friend Network");
    }
    $relationlib = Tikilib::lib('relation');
    $is_friend = $relationlib->get_relation_id("tiki.friend.follow", "user", $user, "user", $other_user);
    if ($is_friend) {
        $action = 'remove';
    } else {
        $action = 'add';
    }
    $smarty = TikiLib::lib('smarty');
    $smarty->assign('add_button_text', $add_button_text);
    $smarty->assign('remove_button_text', $remove_button_text);
    $smarty->assign('userwatch', $other_user);
    $smarty->assign('action', $action);
    return $smarty->fetch('wiki-plugins/wikiplugin_friend.tpl');
}
コード例 #3
0
function wikiplugin_favorite($data, $params)
{
    $smarty = TikiLib::lib('smarty');
    if ($params['objectType'] == 'usertracker') {
        $objectType = 'trackeritem';
        $objectId = 0;
        if ($userid = Tikilib::lib('tiki')->get_user_id($params['objectId'])) {
            $tracker = TikiLib::lib('user')->get_usertracker($userid);
            if ($tracker && $tracker['usersTrackerId']) {
                $objectId = TikiLib::lib('trk')->get_item_id($tracker['usersTrackerId'], $tracker['usersFieldId'], $params['objectId']);
            }
        }
    } else {
        $objectType = $params['objectType'];
        $objectId = $params['objectId'];
    }
    $smarty->assign('wikiplugin_favorite_objectId', urlencode($objectId));
    $smarty->assign('wikiplugin_favorite_objectType', urlencode($objectType));
    $ret = $smarty->fetch('wiki-plugins/wikiplugin_favorite.tpl');
    return $ret;
}
コード例 #4
0
ファイル: WikiPut.php プロジェクト: linuxwhy/tiki-1
 protected function getPage($message, $routing = false)
 {
     $page = $message->getSubject();
     $wikilib = Tikilib::lib('wiki');
     $page = $wikilib->remove_badchars($page);
     if ($this->namespace) {
         return $wikilib->include_namespace($page, $this->namespace);
     } elseif ($routing) {
         if ($route = $this->getRoute($message)) {
             $nsName = $wikilib->get_namespace($route['structName']);
             if (!empty($nsName)) {
                 return $wikilib->include_namespace($page, $nsName);
             }
         }
     }
     return $page;
 }