本文整理汇总了PHP中Category::getTitle方法的典型用法代码示例。如果您正苦于以下问题:PHP Category::getTitle方法的具体用法?PHP Category::getTitle怎么用?PHP Category::getTitle使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Category
的用法示例。
在下文中一共展示了Category::getTitle方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testCategory
public function testCategory()
{
$category = new Category();
$category->setDomain('http://do.main')->setTitle('News')->setDomain('https://www.example.com');
$this->assertEquals('News', $category->getTitle());
$this->assertEquals('https://www.example.com', $category->getDomain());
}
示例2: create
public function create($title, $content, $idAuthor)
{
$category = new Category($this->db);
try {
$category->setTitle($title);
$category->setContent($content);
$category->setIdAuthor($idAuthor);
} catch (Exception $e) {
$errors = $e->getMessage();
echo $errors;
}
if (!isset($err)) {
$title = $this->db->quote($category->getTitle());
$content = $this->db->quote($category->getContent());
$idAuthor = $category->getIdAuthor();
$query = 'INSERT INTO category(title, content, idAuthor)
VALUE (' . $title . ',' . $content . ',' . $idAuthor . ')';
}
$res = $this->db->exec($query);
if ($res) {
$id = $this->db->lastInsertId();
if ($id) {
return $this->findById($id);
} else {
throw new Exception('Database error');
}
} else {
throw new Exception($errors);
}
}
示例3: create
/**
* Метод добавления новой категории
* @param Category $category - категория
* @return bool - категория добавлена/не добавлена
*/
public function create($category)
{
$db = DataBase::getInstance();
$connection = $db->connect();
$sql = "INSERT INTO " . self::TABLE_NAME . " (title) VALUES (:title)";
$stmt = $connection->prepare($sql);
$result = $stmt->execute(array('title' => $category->getTitle()));
$db->close();
return $result;
}
示例4: addSubcategoryObject
/**
* Add a subcategory to the internal lists
*/
function addSubcategoryObject(Category $cat, $sortkey, $pageLength)
{
global $wgRequest;
$title = $cat->getTitle();
if ($wgRequest->getCheck('notree')) {
return parent::addSubcategoryObject($cat, $sortkey, $pageLength);
}
$tree = $this->getCategoryTree();
$this->children[] = $tree->renderNodeInfo($title, $cat);
$this->children_start_char[] = $this->getSubcategorySortChar($title, $sortkey);
}
示例5: testSetGetTitle
public function testSetGetTitle()
{
// Arrange
$c = new Category();
$c->setTitle('drinks');
$expectedResult = 'drinks';
// Act
$result = $c->getTitle();
// Assert
$this->assertEquals($result, $expectedResult);
}
示例6: bulkUpdate
/**
* Method used to bulk update a list of issues
*
* @return boolean
*/
public static function bulkUpdate()
{
// check if user performing this chance has the proper role
if (Auth::getCurrentRole() < User::ROLE_MANAGER) {
return -1;
}
$items = (array) $_POST['item'];
$new_status_id = (int) $_POST['status'];
$new_release_id = (int) $_POST['release'];
$new_priority_id = (int) $_POST['priority'];
$new_category_id = (int) $_POST['category'];
foreach ($items as $issue_id) {
$issue_id = (int) $issue_id;
if (!self::canAccess($issue_id, Auth::getUserID())) {
continue;
}
if (self::getProjectID($issue_id) != Auth::getCurrentProject()) {
// make sure issue is not in another project
continue;
}
$issue_details = self::getDetails($issue_id);
$updated_fields = array();
// update assignment
if (count(@$_POST['users']) > 0) {
$users = (array) $_POST['users'];
// get who this issue is currently assigned too
$stmt = 'SELECT
isu_usr_id,
usr_full_name
FROM
{{%issue_user}},
{{%user}}
WHERE
isu_usr_id = usr_id AND
isu_iss_id = ?';
try {
$current_assignees = DB_Helper::getInstance()->getPair($stmt, array($issue_id));
} catch (DbException $e) {
return -1;
}
foreach ($current_assignees as $usr_id => $usr_name) {
if (!in_array($usr_id, $users)) {
self::deleteUserAssociation($issue_id, $usr_id, false);
}
}
$new_user_names = array();
$new_assignees = array();
foreach ($users as $usr_id) {
$usr_id = (int) $usr_id;
$new_user_names[$usr_id] = User::getFullName($usr_id);
// check if the issue is already assigned to this person
$stmt = 'SELECT
COUNT(*) AS total
FROM
{{%issue_user}}
WHERE
isu_iss_id=? AND
isu_usr_id=?';
$total = DB_Helper::getInstance()->getOne($stmt, array($issue_id, $usr_id));
if ($total > 0) {
continue;
} else {
$new_assignees[] = $usr_id;
// add the assignment
self::addUserAssociation(Auth::getUserID(), $issue_id, $usr_id, false);
Notification::subscribeUser(Auth::getUserID(), $issue_id, $usr_id, Notification::getAllActions());
}
}
$prj_id = Auth::getCurrentProject();
$usr_ids = self::getAssignedUserIDs($issue_id);
Workflow::handleAssignmentChange($prj_id, $issue_id, Auth::getUserID(), $issue_details, $usr_ids, false);
Notification::notifyNewAssignment($new_assignees, $issue_id);
$updated_fields['Assignment'] = History::formatChanges(implode(', ', $current_assignees), implode(', ', $new_user_names));
}
// update status
if ($new_status_id) {
$old_status_id = self::getStatusID($issue_id);
$res = self::setStatus($issue_id, $new_status_id, false);
if ($res == 1) {
$updated_fields['Status'] = History::formatChanges(Status::getStatusTitle($old_status_id), Status::getStatusTitle($new_status_id));
}
}
// update release
if ($new_release_id) {
$old_release_id = self::getRelease($issue_id);
$res = self::setRelease($issue_id, $new_release_id);
if ($res == 1) {
$updated_fields['Release'] = History::formatChanges(Release::getTitle($old_release_id), Release::getTitle($new_release_id));
}
}
// update priority
if ($new_priority_id) {
$old_priority_id = self::getPriority($issue_id);
$res = self::setPriority($issue_id, $new_priority_id);
if ($res == 1) {
//.........这里部分代码省略.........
示例7: addSubcategoryObject
/**
* Add a subcategory to the internal lists, using a Category object
* @param Category $cat
* @param string $sortkey
* @param int $pageLength
*/
function addSubcategoryObject(Category $cat, $sortkey, $pageLength)
{
// Subcategory; strip the 'Category' namespace from the link text.
$title = $cat->getTitle();
$this->children[] = $this->generateLink('subcat', $title, $title->isRedirect(), htmlspecialchars($title->getText()));
$this->children_start_char[] = $this->getSubcategorySortChar($cat->getTitle(), $sortkey);
}
示例8: getOption
function __construct($options)
{
$this->options = $options;
if (isset($this->options['lang'])) {
$this->locale = $this->options['lang'];
} else {
$this->locale = getOption('locale');
}
$this->locale_xml = strtr($this->locale, '_', '-');
if (isset($this->options['sortdir'])) {
$this->sortdirection = strtolower($this->options['sortdir']) != 'asc';
} else {
$this->sortdirection = true;
}
if (isset($this->options['sortorder'])) {
$this->sortorder = $this->options['sortorder'];
} else {
$this->sortorder = NULL;
}
switch ($this->feedtype) {
case 'comments':
if (isset($this->options['type'])) {
$this->commentfeedtype = $this->options['type'];
} else {
$this->commentfeedtype = 'all';
}
if (isset($this->options['id'])) {
$this->id = (int) $this->options['id'];
}
break;
case 'gallery':
if (isset($this->options['albumsmode'])) {
$this->mode = 'albums';
}
if (isset($this->options['folder'])) {
$this->albumfolder = $this->options['folder'];
$this->collection = true;
} else {
if (isset($this->options['albumname'])) {
$this->albumfolder = $this->options['albumname'];
$this->collection = false;
} else {
$this->collection = false;
}
}
if (is_null($this->sortorder)) {
if ($this->mode == "albums") {
$this->sortorder = getOption($this->feed . "_sortorder_albums");
} else {
$this->sortorder = getOption($this->feed . "_sortorder");
}
}
break;
case 'news':
if ($this->sortorder == 'latest') {
$this->sortorder = NULL;
}
if (isset($this->options['category'])) {
$this->catlink = $this->options['category'];
$catobj = new Category($this->catlink);
$this->cattitle = $catobj->getTitle();
$this->newsoption = 'category';
} else {
$this->catlink = '';
$this->cattitle = '';
$this->newsoption = 'news';
}
break;
case 'pages':
break;
case 'null':
//we just want the class instantiated
return;
}
if (isset($this->options['itemnumber'])) {
$this->itemnumber = (int) $this->options['itemnumber'];
} else {
$this->itemnumber = getOption($this->feed . '_items');
}
}
示例9: dview
<?php
if (!path()) {
draw_page('Поваренная книга программиста', dview('index_content', main_categories()));
} elseif (is_category_path(path()) && is_category_exists(path())) {
is_need_cache(true);
$category = new Category(path());
keywords($category->keywords());
draw_page($category->getTitle(), dview('one_category', $category));
} elseif (is_example_path(path()) && is_example_exists(path())) {
is_need_cache(true);
$example = new Example(path());
keywords($example->keywords());
draw_page($example->prop('desc'), view('path_block', ['id' => $example->id()]) . view('one_example', ['data' => $example, 'show_link' => true]));
} else {
show_404();
}
示例10:
function __construct(Category $category)
{
parent::__construct($category->getTitle(), RequestContext::getMain());
$this->limit = self::LIMIT;
# BAC-265
$this->items = [];
$this->count = 0;
}
示例11: elseif
$res = Issue::clearDuplicateStatus($HTTP_GET_VARS["iss_id"]);
$tpl->assign("clear_duplicate_result", $res);
} elseif (@$HTTP_GET_VARS["cat"] == "delete_phone") {
$res = Phone_Support::remove($HTTP_GET_VARS["id"]);
$tpl->assign("delete_phone_result", $res);
} elseif (@$HTTP_GET_VARS["cat"] == "new_status") {
// XXX: need to call the workflow api in the following function?
$res = Issue::setStatus($HTTP_GET_VARS["iss_id"], $HTTP_GET_VARS["new_sta_id"], true);
if ($res == 1) {
History::add($HTTP_GET_VARS["iss_id"], $usr_id, History::getTypeID('status_changed'), "Issue manually set to status '" . Status::getStatusTitle($HTTP_GET_VARS["new_sta_id"]) . "' by " . User::getFullName($usr_id));
}
$tpl->assign("new_status_result", $res);
} elseif (@$HTTP_GET_VARS["cat"] == "new_category") {
$res = Issue::setCategory($HTTP_GET_VARS["iss_id"], $HTTP_GET_VARS["iss_prc_id"], true);
if ($res == 1) {
History::add($HTTP_GET_VARS["iss_id"], $usr_id, History::getTypeID('status_changed'), "Issue manually set to category '" . Category::getTitle($HTTP_GET_VARS["iss_prc_id"]) . "' by " . User::getFullName($usr_id));
}
$tpl->assign("new_status_result", $res);
} elseif (@$HTTP_GET_VARS["cat"] == "new_project") {
$res = Issue::setProject($HTTP_GET_VARS["iss_id"], $HTTP_GET_VARS["iss_prj_id"], true);
if ($res == 1) {
History::add($HTTP_GET_VARS["iss_id"], $usr_id, History::getTypeID('status_changed'), "Issue manually set to project '" . Project::getName($HTTP_GET_VARS["iss_prj_id"]) . "' by " . User::getFullName($usr_id));
}
$tpl->assign("new_status_result", $res);
} elseif (@$HTTP_GET_VARS['cat'] == 'authorize_reply') {
$res = Authorized_Replier::addUser($HTTP_GET_VARS["iss_id"], $usr_id);
$tpl->assign('authorize_reply_result', $res);
} elseif (@$HTTP_GET_VARS['cat'] == 'remove_quarantine') {
if (Auth::getCurrentRole() > User::getRoleID('Developer')) {
$res = Issue::setQuarantine($HTTP_GET_VARS['iss_id'], 0);
$tpl->assign('remove_quarantine_result', $res);
示例12: notifyIssueUpdated
/**
* Method used to send a diff-style notification email to the issue
* subscribers about updates to its attributes.
*
* @param integer $issue_id The issue ID
* @param array $old The old issue details
* @param array $new The new issue details
* @param array $updated_custom_fields An array of the custom fields that were changed.
*/
public static function notifyIssueUpdated($issue_id, $old, $new, $updated_custom_fields)
{
$prj_id = Issue::getProjectID($issue_id);
$diffs = array();
if (@$new['keep_assignments'] == 'no') {
if (empty($new['assignments'])) {
$new['assignments'] = array();
}
$assign_diff = Misc::arrayDiff($old['assigned_users'], $new['assignments']);
if (count($assign_diff) > 0) {
$diffs[] = '-' . ev_gettext('Assignment List') . ': ' . $old['assignments'];
@($diffs[] = '+' . ev_gettext('Assignment List') . ': ' . implode(', ', User::getFullName($new['assignments'])));
}
}
if (isset($new['expected_resolution_date']) && @$old['iss_expected_resolution_date'] != $new['expected_resolution_date']) {
$diffs[] = '-' . ev_gettext('Expected Resolution Date') . ': ' . $old['iss_expected_resolution_date'];
$diffs[] = '+' . ev_gettext('Expected Resolution Date') . ': ' . $new['expected_resolution_date'];
}
if (isset($new['category']) && $old['iss_prc_id'] != $new['category']) {
$diffs[] = '-' . ev_gettext('Category') . ': ' . Category::getTitle($old['iss_prc_id']);
$diffs[] = '+' . ev_gettext('Category') . ': ' . Category::getTitle($new['category']);
}
if (isset($new['release']) && $old['iss_pre_id'] != $new['release']) {
$diffs[] = '-' . ev_gettext('Release') . ': ' . Release::getTitle($old['iss_pre_id']);
$diffs[] = '+' . ev_gettext('Release') . ': ' . Release::getTitle($new['release']);
}
if (isset($new['priority']) && $old['iss_pri_id'] != $new['priority']) {
$diffs[] = '-' . ev_gettext('Priority') . ': ' . Priority::getTitle($old['iss_pri_id']);
$diffs[] = '+' . ev_gettext('Priority') . ': ' . Priority::getTitle($new['priority']);
}
if (isset($new['severity']) && $old['iss_sev_id'] != $new['severity']) {
$diffs[] = '-' . ev_gettext('Severity') . ': ' . Severity::getTitle($old['iss_sev_id']);
$diffs[] = '+' . ev_gettext('Severity') . ': ' . Severity::getTitle($new['severity']);
}
if (isset($new['status']) && $old['iss_sta_id'] != $new['status']) {
$diffs[] = '-' . ev_gettext('Status') . ': ' . Status::getStatusTitle($old['iss_sta_id']);
$diffs[] = '+' . ev_gettext('Status') . ': ' . Status::getStatusTitle($new['status']);
}
if (isset($new['resolution']) && $old['iss_res_id'] != $new['resolution']) {
$diffs[] = '-' . ev_gettext('Resolution') . ': ' . Resolution::getTitle($old['iss_res_id']);
$diffs[] = '+' . ev_gettext('Resolution') . ': ' . Resolution::getTitle($new['resolution']);
}
if (isset($new['estimated_dev_time']) && $old['iss_dev_time'] != $new['estimated_dev_time']) {
$diffs[] = '-' . ev_gettext('Estimated Dev. Time') . ': ' . Misc::getFormattedTime($old['iss_dev_time'] * 60);
$diffs[] = '+' . ev_gettext('Estimated Dev. Time') . ': ' . Misc::getFormattedTime($new['estimated_dev_time'] * 60);
}
if (isset($new['summary']) && $old['iss_summary'] != $new['summary']) {
$diffs[] = '-' . ev_gettext('Summary') . ': ' . $old['iss_summary'];
$diffs[] = '+' . ev_gettext('Summary') . ': ' . $new['summary'];
}
if (isset($new['percent_complete']) && $old['iss_original_percent_complete'] != $new['percent_complete']) {
$diffs[] = '-' . ev_gettext('Percent complete') . ': ' . $old['iss_original_percent_complete'];
$diffs[] = '+' . ev_gettext('Percent complete') . ': ' . $new['percent_complete'];
}
if (isset($new['description']) && $old['iss_description'] != $new['description']) {
$old['iss_description'] = explode("\n", $old['iss_original_description']);
$new['description'] = explode("\n", $new['description']);
$diff = new Text_Diff($old['iss_description'], $new['description']);
$renderer = new Text_Diff_Renderer_unified();
$desc_diff = explode("\n", trim($renderer->render($diff)));
$diffs[] = 'Description:';
foreach ($desc_diff as $diff) {
$diffs[] = $diff;
}
}
$data = Issue::getDetails($issue_id);
$data['diffs'] = implode("\n", $diffs);
$data['updated_by'] = User::getFullName(Auth::getUserID());
$all_emails = array();
$role_emails = array(User::ROLE_VIEWER => array(), User::ROLE_REPORTER => array(), User::ROLE_CUSTOMER => array(), User::ROLE_USER => array(), User::ROLE_DEVELOPER => array(), User::ROLE_MANAGER => array(), User::ROLE_ADMINISTRATOR => array());
$users = self::getUsersByIssue($issue_id, 'updated');
foreach ($users as $user) {
if (empty($user['sub_usr_id'])) {
$email = $user['sub_email'];
// non users are treated as "Viewers" for permission checks
$role = User::ROLE_VIEWER;
} else {
$prefs = Prefs::get($user['sub_usr_id']);
if (Auth::getUserID() == $user['sub_usr_id'] && (empty($prefs['receive_copy_of_own_action'][$prj_id]) || $prefs['receive_copy_of_own_action'][$prj_id] == false)) {
continue;
}
$email = User::getFromHeader($user['sub_usr_id']);
$role = $user['pru_role'];
}
// now add it to the list of emails
if (!empty($email) && !in_array($email, $all_emails)) {
$all_emails[] = $email;
$role_emails[$role][] = $email;
}
}
// get additional email addresses to notify
//.........这里部分代码省略.........
示例13: printLatestNewsCustom
function printLatestNewsCustom($number = 5, $category = '', $showdate = true, $showcontent = true, $contentlength = 70, $showcat = true)
{
global $_zp_gallery, $_zp_current_article;
$latest = getLatestNews($number, $category);
echo "\n<div id=\"latestnews-spotlight\">\n";
$count = "";
foreach ($latest as $item) {
$count++;
$category = "";
$categories = "";
$obj = newArticle($item['titlelink']);
$title = htmlspecialchars($obj->getTitle());
$link = getNewsURL($item['titlelink']);
$count2 = 0;
$category = $obj->getCategories();
foreach ($category as $cat) {
$catobj = new Category($cat['titlelink']);
$count2++;
if ($count2 != 1) {
$categories = $categories . "; ";
}
$categories = $categories . $catobj->getTitle();
}
$content = strip_tags($obj->getContent());
$date = zpFormattedDate(getOption('date_format'), strtotime($item['date']));
$type = 'news';
echo "<div>";
echo "<h3><a href=\"" . $link . "\" title=\"" . strip_tags(htmlspecialchars($title, ENT_QUOTES)) . "\">" . htmlspecialchars($title) . "</a></h3>\n";
echo "<div class=\"newsarticlecredit\">\n";
echo "<span class=\"latestnews-date\">" . $date . "</span>\n";
echo "<span class=\"latestnews-cats\">| Posted in " . $categories . "</span>\n";
echo "</div>\n";
echo "<p class=\"latestnews-desc\">" . html_encode(getContentShorten($content, $contentlength, '(...)', null, null)) . "</p>\n";
echo "</div>\n";
if ($count == $number) {
break;
}
}
echo "</div>\n";
}
示例14: getAdminList
/**
* Method used to get the list of reminder conditions to be displayed in the
* administration section.
*
* @access public
* @param integer $rma_id The reminder action ID
* @return array The list of reminder conditions
*/
function getAdminList($rma_id)
{
$stmt = "SELECT\n rlc_id,\n rlc_value,\n rlc_comparison_rmf_id,\n rmf_title,\n rmo_title\n FROM\n " . APP_DEFAULT_DB . "." . APP_TABLE_PREFIX . "reminder_level_condition,\n " . APP_DEFAULT_DB . "." . APP_TABLE_PREFIX . "reminder_field,\n " . APP_DEFAULT_DB . "." . APP_TABLE_PREFIX . "reminder_operator\n WHERE\n rlc_rmf_id=rmf_id AND\n rlc_rmo_id=rmo_id AND\n rlc_rma_id=" . Misc::escapeInteger($rma_id) . "\n ORDER BY\n rlc_id ASC";
$res = $GLOBALS["db_api"]->dbh->getAll($stmt, DB_FETCHMODE_ASSOC);
if (PEAR::isError($res)) {
Error_Handler::logError(array($res->getMessage(), $res->getDebugInfo()), __FILE__, __LINE__);
return array();
} else {
for ($i = 0; $i < count($res); $i++) {
if (!empty($res[$i]['rlc_comparison_rmf_id'])) {
$res[$i]['rlc_value'] = 'Field: ' . Reminder_Condition::getFieldTitle($res[$i]['rlc_comparison_rmf_id']);
} elseif (strtolower($res[$i]['rmf_title']) == 'status') {
$res[$i]['rlc_value'] = Status::getStatusTitle($res[$i]['rlc_value']);
} elseif (strtolower($res[$i]['rmf_title']) == 'category') {
$res[$i]['rlc_value'] = Category::getTitle($res[$i]['rlc_value']);
} elseif (strtoupper($res[$i]['rlc_value']) != 'NULL') {
$res[$i]['rlc_value'] .= ' hours';
}
}
return $res;
}
}
示例15: getAdminList
/**
* Method used to get the list of reminder conditions to be displayed in the
* administration section.
*
* @param integer $rma_id The reminder action ID
* @return array The list of reminder conditions
*/
public static function getAdminList($rma_id)
{
$stmt = 'SELECT
rlc_id,
rlc_value,
rlc_comparison_rmf_id,
rmf_title,
rmo_title
FROM
{{%reminder_level_condition}},
{{%reminder_field}},
{{%reminder_operator}}
WHERE
rlc_rmf_id=rmf_id AND
rlc_rmo_id=rmo_id AND
rlc_rma_id=?
ORDER BY
rlc_id ASC';
try {
$res = DB_Helper::getInstance()->getAll($stmt, array($rma_id));
} catch (DbException $e) {
return array();
}
foreach ($res as &$row) {
if (!empty($row['rlc_comparison_rmf_id'])) {
$row['rlc_value'] = ev_gettext('Field') . ': ' . self::getFieldTitle($row['rlc_comparison_rmf_id']);
} elseif (strtolower($row['rmf_title']) == 'status') {
$row['rlc_value'] = Status::getStatusTitle($row['rlc_value']);
} elseif (strtolower($row['rmf_title']) == 'category') {
$row['rlc_value'] = Category::getTitle($row['rlc_value']);
} elseif (strtolower($row['rmf_title']) == 'group' || strtolower($row['rmf_title']) == 'active group') {
$row['rlc_value'] = Group::getName($row['rlc_value']);
} elseif (strtoupper($row['rlc_value']) != 'NULL') {
$row['rlc_value'] .= ' ' . ev_gettext('hours');
}
}
return $res;
}