本文整理汇总了PHP中Wiki::findByProjectId方法的典型用法代码示例。如果您正苦于以下问题:PHP Wiki::findByProjectId方法的具体用法?PHP Wiki::findByProjectId怎么用?PHP Wiki::findByProjectId使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Wiki
的用法示例。
在下文中一共展示了Wiki::findByProjectId方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testFindByProjectId
/**
* testFindByProjectId method
*
* @return void
*/
public function testFindByProjectId()
{
$data = $this->Wiki->findByProjectId(1);
$this->assertEqual($data['Wiki']['id'], 1);
foreach ($data['WikiPage'] as $row) {
$this->assertEqual($row['wiki_id'], 1);
}
//$this->assertEqual($data['WikiPage'][1]['title'], "日本語ページ");
}
示例2: isset
function _replaceWikiLinks($already_matched)
{
/* Wiki links
* Examples:
* [[mypage]]
* [[mypage|mytext]]
* wiki links can refer other project wikis, using project name or identifier:
* [[project:]] -> wiki starting page
* [[project:|mytext]]
* [[project:mypage]]
* [[project:mypage|mytext]]
*/
$view = $this->_View;
$link_project = isset($view->viewVars['main_project']) ? $view->viewVars['main_project'] : null;
list(, $esc, $all, $page, $title) = $already_matched;
$result = $all;
if ($esc === "") {
if (preg_match('/^([^\\:]+)\\:(.*)$/', $page, $matches)) {
list(, $project_name, $page) = $matches;
App::import('Model', 'Project');
$project_model = new Project();
$project_model->recursive = -1;
$link_project = $project_model->findByName($project_name);
if (empty($link_project)) {
$link_project = $project_model->findByIdentifier($project_name);
}
if ($title === "" && $page === "") {
$title = $project_name;
}
}
App::import('Model', 'Wiki');
$wiki_model = new Wiki();
$wiki_model->recursive = -1;
$link_project_wiki = $wiki_model->findByProjectId($link_project['Project']['id']);
if ($link_project && $link_project_wiki) {
// extract anchor
$anchor = "";
if (preg_match('/^(.+?)\\#(.+)$/', $page, $matches)) {
list(, $page, $anchor) = $matches;
}
// check if page exists
$wiki_page = null;
$wiki_model->id = $link_project_wiki['Wiki']['id'];
$wiki_page = $wiki_model->find_page($page);
$class = 'wiki-page';
if (!$wiki_page) {
$class .= ' new';
}
$result = $this->Html->link($title !== "" ? $title : $page, array('controller' => 'wiki', 'action' => 'index', 'project_id' => $link_project['Project']['identifier'], 'wikipage' => $page), array('class' => $class));
} else {
if ($title !== "") {
$result = $title;
} else {
$result = $page;
}
}
} else {
$result = $all;
}
return $result;
}