本文整理汇总了PHP中Page::getId方法的典型用法代码示例。如果您正苦于以下问题:PHP Page::getId方法的具体用法?PHP Page::getId怎么用?PHP Page::getId使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Page
的用法示例。
在下文中一共展示了Page::getId方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: updatePage
public function updatePage(Page $page)
{
$result = $this->pageDao->findByIdAndPosition($page->getId(), $page->getPosition());
ResultHelper::whenEmpty($result, AppLabelUtil::$ERROR_PAGE_NOT_FOUND, HttpStatusCode::badRequest());
$page->setPosition($result->getPosition());
$this->pageDao->update($page);
}
示例2: hasApplicationAnswers
/**
* Check if a page has any answers associated with it for a specific application
* @param Page $page
* @param Application $application
* @return boolean
*/
public function hasApplicationAnswers(Page $page, Application $application)
{
$query = $this->_em->createQuery('SELECT COUNT(answer.id) as ancnt FROM Jazzee\\Entity\\Answer answer JOIN answer.applicant applicant WHERE answer.page = :pageId AND applicant.application = :applicationId');
$query->setParameter('pageId', $page->getId());
$query->setParameter('applicationId', $application->getId());
$result = $query->getResult();
return $result[0]['ancnt'] > 0;
}
示例3: smarty_function_select_page_populate_options
/**
* Populate options array with options recursivly
*
* @param Page $page
* @param integer $value
* @param User $user
* @param Page $skip
* @param array $options
* @param string $indent
* @return null
*/
function smarty_function_select_page_populate_options($page, $value, $user, $skip, &$options, $indent = '')
{
if (instance_of($skip, 'Page') && $skip->getId() == $page->getId()) {
return;
}
// if
$attributes = $value == $page->getId() ? array('selected' => true) : null;
$options[] = option_tag($indent . $page->getName(), $page->getId(), $attributes);
$subpages = $page->getSubpages($user->getVisibility());
if (is_foreachable($subpages)) {
foreach ($subpages as $subpage) {
smarty_function_select_page_populate_options($subpage, $value, $user, $skip, $options, $indent . '- ');
}
// foreach
}
// if
}
示例4: mapPageToDto
/**
* @param page Page
* @return PageDto
*/
public function mapPageToDto(Page $page)
{
$pageDto = new PageDto();
$pageDto->setId($page->getId());
$pageDto->setTitle($page->getTitle());
$pageDto->setName($page->getName());
$pageDto->setDescription($page->getDescription());
$pageDto->setPosition($page->getPosition());
return $pageDto;
}
示例5: findUnMatchedScores
/**
* Find any unmatched score answers for a page
* @param \Jazzee\Entity\Page $page
* @return array
*/
public function findUnMatchedScores(Page $page)
{
$query = 'SELECT a, e FROM Jazzee\\Entity\\Answer a ';
$query .= 'LEFT JOIN a.elements e ';
$query .= 'WHERE a.page = :pageId AND a.pageStatus IS NULL AND a.greScore IS NULL AND a.toeflScore IS NULL';
$query = $this->_em->createQuery($query);
$query->setParameter('pageId', $page->getId());
$query->setHint(\Doctrine\ORM\Query::HINT_INCLUDE_META_COLUMNS, true);
return $query->getArrayResult();
}
示例6: setPage
/**
* Set parent page
*
* @param Page $page
* @return null
*/
function setPage($page)
{
$this->setPageId($page->getId());
if ($this->isNew()) {
$this->setName($page->old_name ? $page->old_name : $page->getName());
$this->setBody($page->old_body ? $page->old_body : $page->getBody());
$this->setVersion($page->getRevisionNum());
}
// if
}
示例7: array
function goto_tasks_page_for_user()
{
$user = Users::findById($this->request->getId('selected_user_id'));
$page_title = $user->getName() . ' - Task List';
$link = mysql_connect(DB_HOST, DB_USER, DB_PASS);
mysql_select_db(DB_NAME, $link);
$query = "select id from healingcrystals_project_objects where type='Page' and project_id='" . TASK_LIST_PROJECT_ID . "' and name='" . mysql_real_escape_string($page_title) . "'";
$result = mysql_query($query, $link);
if (mysql_num_rows($result)) {
$info = mysql_fetch_assoc($result);
$this->redirectToUrl(assemble_url('project_page', array('project_id' => TASK_LIST_PROJECT_ID, 'page_id' => $info['id'])));
} else {
$query = "select id from healingcrystals_project_objects where type='Category' and module='pages' and project_id='" . TASK_LIST_PROJECT_ID . "' and name='General'";
$page_category = mysql_query($query);
$page_category_info = mysql_fetch_assoc($page_category);
$page_data = array('type' => 'Page', 'module' => 'pages', 'visibility' => VISIBILITY_NORMAL, 'name' => $page_title, 'body' => 'Auto-generated Task List Page', 'integer_field_1' => '1');
db_begin_work();
$this->active_page = new Page();
$this->active_page->setAttributes($page_data);
$this->active_page->setProjectId(TASK_LIST_PROJECT_ID);
$this->active_page->setCreatedBy($this->logged_user);
$this->active_page->setState(STATE_VISIBLE);
$this->active_page->setParentId($page_category_info['id']);
$save = $this->active_page->save();
if ($save && !is_error($save)) {
//$subscribers = array($this->logged_user->getId());
//if(!in_array($this->active_project->getLeaderId(), $subscribers)) {
// $subscribers[] = $this->active_project->getLeaderId();
//}
//Subscriptions::subscribeUsers($subscribers, $this->active_page);
db_commit();
$this->active_page->ready();
$query = "select * from healingcrystals_project_users where user_id='" . $user->getId() . "' and project_id='" . TASK_LIST_PROJECT_ID . "'";
$result = mysql_query($query, $link);
if (!mysql_num_rows($result)) {
//mysql_query("insert into healingcrystals_project_users (user_id, project_id, role_id, permissions) values ('" . $user->getId() . "', '" . TASK_LIST_PROJECT_ID . "', '" . $user->getRoleId() . "', 'N;')");
mysql_query("insert into healingcrystals_project_users (user_id, project_id, role_id, permissions) values ('" . $user->getId() . "', '" . TASK_LIST_PROJECT_ID . "', '7', 'N;')");
} elseif ($user->getRoleId() == '2') {
mysql_query("update healingcrystals_project_users set role_id='7' where user_id='" . $user->getId() . "' and project_id='" . TASK_LIST_PROJECT_ID . "'");
}
$this->redirectToUrl(assemble_url('project_page', array('project_id' => TASK_LIST_PROJECT_ID, 'page_id' => $this->active_page->getId())));
} else {
db_rollback();
//$save .= 'rollback';
}
}
mysql_close($link);
$this->smarty->assign(array('user' => $user, 'project' => $this->active_project, 'errors' => $save, 'data' => $page_data));
}
示例8: newFromArticle
/**
* Return PlaceStorage model for given article
*
* @param Page $article article object
* @return PlaceStorage model object
*/
public static function newFromArticle(Page $article)
{
return self::newFromId($article->getId());
}
示例9: findSubpages
/**
* Return subpages
*
* @param Page $page
* @param integer $min_state
* @param integer $min_visibility
* @return array
*/
function findSubpages($page, $min_state = STATE_VISIBLE, $min_visibility = VISIBILITY_NORMAL)
{
return Pages::find(array('conditions' => array('parent_id = ? AND type = ? AND state >= ? AND visibility >= ?', $page->getId(), 'Page', $min_state, $min_visibility, false), 'order' => 'ISNULL(position) ASC, position'));
}
示例10: addInstanceToPool
/**
* Adds an object to the instance pool.
*
* Propel keeps cached copies of objects in an instance pool when they are retrieved
* from the database. In some cases -- especially when you override doSelect*()
* methods in your stub classes -- you may need to explicitly add objects
* to the cache in order to ensure that the same objects are always returned by doSelect*()
* and retrieveByPK*() calls.
*
* @param Page $value A Page object.
* @param string $key (optional) key to use for instance map (for performance boost if key was already calculated externally).
*/
public static function addInstanceToPool(Page $obj, $key = null)
{
if (Propel::isInstancePoolingEnabled()) {
if ($key === null) {
$key = (string) $obj->getId();
}
// if key === null
self::$instances[$key] = $obj;
}
}
示例11: move
function move()
{
$new_parent_id = $this->request->post('new_parent_id');
$new_parent_type = $this->request->post('new_parent_type');
$new_parent_url = '';
$move_mode = false;
if (!empty($new_parent_id) && !empty($new_parent_type)) {
$move_mode = true;
$parent_obj = $sql_part = null;
switch ($new_parent_type) {
case 'milestone':
$parent_obj = new MileStone($new_parent_id);
break;
case 'ticket':
$parent_obj = new Ticket($new_parent_id);
break;
case 'page':
$parent_obj = new Page($new_parent_id);
break;
}
if ($parent_obj) {
$body = $this->active_task->getBody();
$doc = new DOMDocument();
if ($doc->loadHTML($body)) {
$anc_tags = $doc->getElementsByTagName('a');
$new_parent_url = '';
foreach ($anc_tags as $anc) {
if ($anc->nodeValue == 'View Task in Full') {
$href = $anc->getAttribute('href');
$fragment = substr($href, strpos($href, '#'));
$anc->setAttribute('href', $parent_obj->getViewUrl() . $fragment);
break;
}
}
if (!empty($fragment)) {
$body_tag = $doc->getElementsByTagName('body');
$body = $doc->saveXML($body_tag->item(0)->firstChild);
$comment_id = str_replace('#comment', '', $fragment);
}
}
$link = mysql_connect(DB_HOST, DB_USER, DB_PASS);
mysql_select_db(DB_NAME);
$query = "update \n\t\t\t\t\t\t\thealingcrystals_project_objects \n\t\t\t\t\t\t set \n\t\t\t\t\t\t\tproject_id='" . $parent_obj->getProjectId() . "', \n\t\t\t\t\t\t\tmilestone_id='" . $parent_obj->getMilestoneId() . "', \n\t\t\t\t\t\t\tparent_id='" . $parent_obj->getId() . "', \n\t\t\t\t\t\t\tparent_type='" . $parent_obj->getType() . "', \n\t\t\t\t\t\t\tbody = '" . mysql_real_escape_string($body) . "' \n\t\t\t\t\t\t where\tid='" . $this->active_task->getId() . "'";
mysql_query($query, $link);
if (!empty($comment_id)) {
$comment_query = "update \n\t\t\t\t\t\t\thealingcrystals_project_objects \n\t\t\t\t\t\t set \n\t\t\t\t\t\t\tproject_id='" . $parent_obj->getProjectId() . "', \n\t\t\t\t\t\t\tmilestone_id='" . $parent_obj->getMilestoneId() . "', \n\t\t\t\t\t\t\tparent_id='" . $parent_obj->getId() . "', \n\t\t\t\t\t\t\tparent_type='" . $parent_obj->getType() . "', \n\t\t\t\t\t\t\tposition=null\n\t\t\t\t\t\t where\tid='" . $comment_id . "'";
mysql_query($comment_query, $link);
}
mysql_close($link);
$new_parent_url = $parent_obj->getViewUrl() . '#task' . $this->active_task->getId();
$cache_id = TABLE_PREFIX . 'project_objects_id_' . $this->active_task->getId();
$cache_obj = cache_get($cache_id);
if ($cache_obj) {
cache_remove($cache_id);
}
}
} else {
$listing = array();
switch ($this->active_task_parent->getType()) {
case 'Milestone':
//$listing = Milestones::findByProject($this->active_project, $this->logged_user);
$listing = Milestones::findActiveByProject_custom($this->active_project);
break;
case 'Ticket':
$listing = Tickets::findOpenByProjectByNameSort($this->active_project, STATE_VISIBLE, $this->logged_user->getVisibility());
break;
case 'Page':
$categories = Categories::findByModuleSection($this->active_project, 'pages', 'pages');
$listing = Pages::findByCategories($categories, STATE_VISIBLE, $this->logged_user->getVisibility());
/*foreach($categories as $category){
$listing = array_merge($listing, Pages::findByCategory($category, STATE_VISIBLE, $this->logged_user->getVisibility()));
}*/
break;
}
$this->smarty->assign(array('teams' => Projects::findNamesByUser($this->logged_user), 'listing' => $listing, 'task_parent_id' => $this->active_task_parent->getId()));
}
$this->smarty->assign('new_parent_url', $new_parent_url);
$this->smarty->assign('move_mode', $move_mode);
}
示例12: purgeCache
/**
* Deletes the form definition associated with the given wiki page
* from the main cache.
*
* Hooks: ArticlePurge, ArticleSave
*
* @param Page $wikipage
* @return bool
*/
public static function purgeCache(Page $wikipage)
{
if (!$wikipage->getTitle()->inNamespace(SF_NS_FORM)) {
return true;
}
$cache = self::getFormCache();
$cacheKeyForList = self::getCacheKey($wikipage->getId());
// get references to stored datasets
$listOfFormKeys = $cache->get($cacheKeyForList);
if (!is_array($listOfFormKeys)) {
return true;
}
// delete stored datasets
foreach ($listOfFormKeys as $key) {
$cache->delete($key);
wfDebug("Deleted cached form definition {$key}.\n");
}
// delete references to datasets
$cache->delete($cacheKeyForList);
wfDebug("Deleted cached form definition references {$cacheKeyForList}.\n");
return true;
}
示例13: displayPage
public function displayPage(Page $page)
{
$pageIds = $this->getPageIds();
return in_array($page->getId(), $pageIds);
}
示例14: getPageId
function getPageId(&$incoming_mail, &$project, &$user)
{
$page_id = '';
list($user_name, ) = explode('-', $incoming_mail->getSubject());
$user_name = trim($user_name);
$name_parts = explode(' ', $user_name);
list($first_name, $last_name) = $name_parts;
$link = mysql_connect(DB_HOST, DB_USER, DB_PASS);
mysql_select_db(DB_NAME, $link);
$query = "select id from healingcrystals_users where first_name='" . mysql_real_escape_string($first_name) . "' " . (!empty($last_name) ? " and last_name='" . mysql_real_escape_string($last_name) . "' " : "");
$result = mysql_query($query, $link);
if (mysql_num_rows($result)) {
$info = mysql_fetch_assoc($result);
$user_id = $info['id'];
} elseif (strpos($incoming_mail->getSubject(), '}') !== false) {
$user_id = substr($incoming_mail->getSubject(), strrpos($incoming_mail->getSubject(), '{') + 1, -1);
}
if (!empty($user_id)) {
$task_meant_for_user = Users::findById($user_id);
$page_title = $task_meant_for_user->getName() . ' - Task List';
//echo $page_title . '<br/>';
$query2 = "select id from healingcrystals_project_objects where type='Page' and project_id='" . TASK_LIST_PROJECT_ID . "' and name='" . mysql_real_escape_string($page_title) . "'";
//echo $query2 . '<br/>';
$result2 = mysql_query($query2, $link);
if (mysql_num_rows($result2)) {
$info2 = mysql_fetch_assoc($result2);
$page_id = $info2['id'];
} else {
$query3 = "select id from healingcrystals_project_objects where type='Category' and module='pages' and project_id='" . TASK_LIST_PROJECT_ID . "' and name='General'";
//echo $query3 . '<br/>';
$page_category = mysql_query($query3, $link);
$page_category_info = mysql_fetch_assoc($page_category);
$category_id = $page_category_info['id'];
//echo $category_id . '<br/>';
$page_data = array('type' => 'Page', 'module' => 'pages', 'visibility' => VISIBILITY_NORMAL, 'name' => $page_title, 'body' => 'Auto-generated Task List Page', 'integer_field_1' => '1');
//print_r($page_data);
//db_begin_work();
$page = new Page();
$page->setAttributes($page_data);
$page->setProjectId(TASK_LIST_PROJECT_ID);
$page->setCreatedBy($user);
$page->setState(STATE_VISIBLE);
$page->setParentId($category_id);
$page->save();
$page->ready();
$page_id = $page->getId();
}
$query = "select * from healingcrystals_project_users where user_id='" . $task_meant_for_user->getId() . "' and project_id='" . TASK_LIST_PROJECT_ID . "'";
$result = mysql_query($query, $link);
if (!mysql_num_rows($result)) {
//mysql_query("insert into healingcrystals_project_users (user_id, project_id, role_id, permissions) values ('" . $user->getId() . "', '" . TASK_LIST_PROJECT_ID . "', '" . $user->getRoleId() . "', 'N;')");
mysql_query("insert into healingcrystals_project_users (user_id, project_id, role_id, permissions) values ('" . $task_meant_for_user->getId() . "', '" . TASK_LIST_PROJECT_ID . "', '7', 'N;')");
} elseif ($user->getRoleId() == '2') {
mysql_query("update healingcrystals_project_users set role_id='7' where user_id='" . $task_meant_for_user->getId() . "' and project_id='" . TASK_LIST_PROJECT_ID . "'");
}
}
mysql_close($link);
return $page_id;
}
示例15: getTaskPageIdForUser
function getTaskPageIdForUser($user_id)
{
$page_id = '';
$user = new User($user_id);
$name = $user->getName();
list($first_name, $last_name) = explode(' ', $name);
$link = mysql_connect(DB_HOST, DB_USER, DB_PASS);
mysql_select_db(DB_NAME, $link);
$page_title = $name . ' - Task List';
$query2 = "select id from healingcrystals_project_objects where type='Page' and project_id='" . TASK_LIST_PROJECT_ID . "' and name='" . mysql_real_escape_string($page_title) . "'";
$result2 = mysql_query($query2, $link);
if (mysql_num_rows($result2)) {
$info2 = mysql_fetch_assoc($result2);
$page_id = $info2['id'];
} else {
$query3 = "select id from healingcrystals_project_objects where type='Category' and module='pages' and project_id='" . TASK_LIST_PROJECT_ID . "' and name='General'";
$page_category = mysql_query($query3, $link);
$page_category_info = mysql_fetch_assoc($page_category);
$category_id = $page_category_info['id'];
$page_data = array('type' => 'Page', 'module' => 'pages', 'visibility' => VISIBILITY_NORMAL, 'name' => $page_title, 'body' => 'Auto-generated Task List Page', 'integer_field_1' => '1');
$page = new Page();
$page->setAttributes($page_data);
$page->setProjectId(TASK_LIST_PROJECT_ID);
$page->setCreatedBy($user);
$page->setState(STATE_VISIBLE);
$page->setParentId($category_id);
$page->save();
$page->ready();
$page_id = $page->getId();
$query = "select * from healingcrystals_project_users where user_id='" . $user_id . "' and project_id='" . TASK_LIST_PROJECT_ID . "'";
$result = mysql_query($query, $link);
if (!mysql_num_rows($result)) {
mysql_query("insert into healingcrystals_project_users (user_id, project_id, role_id, permissions) values ('" . $user_id . "', '" . TASK_LIST_PROJECT_ID . "', '7', 'N;')");
} elseif ($user->getRoleId() == '2') {
mysql_query("update healingcrystals_project_users set role_id='7' where user_id='" . $user_id . "' and project_id='" . TASK_LIST_PROJECT_ID . "'");
}
}
//mysql_close($link);
return $page_id;
}