Skip to content

Commit

Permalink
Rename api function for code conventions - refs BT#9070
Browse files Browse the repository at this point in the history
  • Loading branch information
AngelFQC committed Feb 6, 2015
1 parent 4f9e3d7 commit db49eca
Show file tree
Hide file tree
Showing 11 changed files with 25 additions and 25 deletions.
2 changes: 1 addition & 1 deletion main/course_home/course_home.php
Expand Up @@ -138,7 +138,7 @@
$sessionId = api_get_session_id();
$show_message = '';

if (apiIsInvitedUser()) {
if (api_is_invitee_user()) {
$isInASession = $sessionId > 0;
$isSubscribed = CourseManager::is_user_subscribed_in_course($user_id, $course_code, $isInASession, $sessionId);

Expand Down
2 changes: 1 addition & 1 deletion main/forum/newthread.php
Expand Up @@ -119,7 +119,7 @@ function advanced_parameters() {
}

// 6. Invited users can't create new threads
if (apiIsInvitedUser()) {
if (api_is_invitee_user()) {
api_not_allowed(true);
}

Expand Down
2 changes: 1 addition & 1 deletion main/forum/viewforum.php
Expand Up @@ -295,7 +295,7 @@
($current_forum['allow_new_threads'] == 1 AND !isset($_user['user_id']) AND $current_forum['allow_anonymous'] == 1)
) {
if ($current_forum['locked'] <> 1 AND $current_forum['locked'] <> 1) {
if (!api_is_anonymous() && !apiIsInvitedUser()) {
if (!api_is_anonymous() && !api_is_invitee_user()) {
if ($my_forum == strval(intval($my_forum))) {
echo '<a href="'.$forumUrl.'newthread.php?'.api_get_cidreq().'&amp;forum='.Security::remove_XSS($my_forum).$origin_string.'">'.
Display::return_icon('new_thread.png',get_lang('NewTopic'),'',ICON_SIZE_MEDIUM).'</a>';
Expand Down
2 changes: 1 addition & 1 deletion main/inc/lib/course.lib.php
Expand Up @@ -4651,7 +4651,7 @@ public static function return_hot_courses($days = 30, $limit = 5)
{
global $_configuration;

if (apiIsInvitedUser()) {
if (api_is_invitee_user()) {
return array();
}

Expand Down
4 changes: 2 additions & 2 deletions main/inc/lib/main_api.lib.php
Expand Up @@ -2565,7 +2565,7 @@ function api_is_teacher() {
* Checks whether the current user is a invited user
* @return boolean
*/
function apiIsInvitedUser() {
function api_is_invitee_user() {
global $_user;

return isset($_user['status']) && $_user['status'] == INVITEE;
Expand Down Expand Up @@ -7538,7 +7538,7 @@ function apiIsExcludedUserType($checkDB = false, $userId = 0)
}
}

$isInvited = apiIsInvitedUser();
$isInvited = api_is_invitee_user();
$isAnonymous = api_is_anonymous();

if ($isInvited || $isAnonymous) {
Expand Down
12 changes: 6 additions & 6 deletions main/newscorm/learnpath.class.php
Expand Up @@ -204,7 +204,7 @@ public function __construct($course, $lp_id, $user_id)
$this->last_item_seen = $row['last_item'];
$this->progress_db = $row['progress'];
$this->lp_view_session_id = $row['session_id'];
} else if (!apiIsInvitedUser()) {
} else if (!api_is_invitee_user()) {
if ($this->debug > 2) {
error_log('New LP - learnpath::__construct() ' . __LINE__ . ' - NOT Found previous view', 0);
}
Expand Down Expand Up @@ -351,7 +351,7 @@ public function __construct($course, $lp_id, $user_id)
}
}
} else {
if (!apiIsInvitedUser()) {
if (!api_is_invitee_user()) {
if (is_object($this->items[$item_id])) {
$this->items[$item_id]->set_status($this->default_status);
}
Expand Down Expand Up @@ -3613,7 +3613,7 @@ public function get_view($attempt_num = 0)
if (Database :: num_rows($res) > 0) {
$row = Database :: fetch_array($res);
$this->lp_view_id = $row['id'];
} else if (!apiIsInvitedUser()) {
} else if (!api_is_invitee_user()) {
// There is no database record, create one.
$sql = "INSERT INTO $lp_view_table (c_id, lp_id,user_id, view_count, session_id) VALUES
($course_id, " . $this->get_id() . "," . $this->get_user_id() . ", 1, $sessionId)";
Expand Down Expand Up @@ -4192,7 +4192,7 @@ public function restart()
// TODO
// Call autosave method to save the current progress.
//$this->index = 0;
if (apiIsInvitedUser()) {
if (api_is_invitee_user()) {
return false;
}
$session_id = api_get_session_id();
Expand Down Expand Up @@ -4312,7 +4312,7 @@ public function save_last()
$session_condition = api_get_session_condition(api_get_session_id(), true, false);
$table = Database :: get_course_table(TABLE_LP_VIEW);

if (isset($this->current) && !apiIsInvitedUser()) {
if (isset($this->current) && !api_is_invitee_user()) {
if ($this->debug > 2) {
error_log('New LP - Saving current item (' . $this->current . ') for later review', 0);
}
Expand All @@ -4329,7 +4329,7 @@ public function save_last()
Database::query($sql);
}

if (!apiIsInvitedUser()) {
if (!api_is_invitee_user()) {
// Save progress.
list($progress, $text) = $this->get_progress_bar_text('%');
if ($progress >= 0 && $progress <= 100) {
Expand Down
10 changes: 5 additions & 5 deletions main/newscorm/learnpathItem.class.php
Expand Up @@ -3798,7 +3798,7 @@ public function write_to_db()
if ($this->type == 'quiz' && $this->get_prevent_reinit() == 0 &&
$this->get_status() == 'completed'
) {
if (!apiIsInvitedUser()) {
if (!api_is_invitee_user()) {
// We force the item to be restarted.
$this->restart();
$params = array(
Expand Down Expand Up @@ -3843,7 +3843,7 @@ public function write_to_db()
// Depending on what we want (really), we'll update or insert a new row
// now save into DB.
if (!$inserted && Database::num_rows($check_res) < 1) {
if (!apiIsInvitedUser()) {
if (!api_is_invitee_user()) {
$params = array(
"c_id" => $course_id,
"total_time" => $this->get_total_time(),
Expand All @@ -3870,7 +3870,7 @@ public function write_to_db()
}
} else {
if ($this->type == 'hotpotatoes') {
if (!apiIsInvitedUser()) {
if (!api_is_invitee_user()) {
$params = array(
'total_time' => $this->get_total_time(),
'start_time' => $this->get_current_start_time(),
Expand Down Expand Up @@ -4009,7 +4009,7 @@ public function write_to_db()
}

if ($this->type == 'sco') {
if (!apiIsInvitedUser()) {
if (!api_is_invitee_user()) {
//IF scorm scorm_update_time has already updated total_time in db
//" . //start_time = ".$this->get_current_start_time().", " . //scorm_init_time does it
////" max_time_allowed = '".$this->get_max_time_allowed()."'," .
Expand All @@ -4027,7 +4027,7 @@ public function write_to_db()
}

} else {
if (!apiIsInvitedUser()) {
if (!api_is_invitee_user()) {
//" max_time_allowed = '".$this->get_max_time_allowed()."'," .
$sql = "UPDATE $item_view_table SET
$total_time
Expand Down
6 changes: 3 additions & 3 deletions main/newscorm/lp_list.php
Expand Up @@ -118,7 +118,7 @@ function confirmation(name) {
echo '<th width="300px">'.get_lang('AuthoringOptions')."</th>";
} else {
echo '<th width="50%">'.get_lang('Title').'</th>';
if (!apiIsInvitedUser()) {
if (!api_is_invitee_user()) {
echo '<th>'.get_lang('Progress')."</th>";
}
echo '<th>'.get_lang('Actions')."</th>";
Expand Down Expand Up @@ -230,7 +230,7 @@ function confirmation(name) {

$progress = 0;

if (!apiIsInvitedUser()) {
if (!api_is_invitee_user()) {
$progress = learnpath::getProgress(
$id,
$userId,
Expand All @@ -244,7 +244,7 @@ function confirmation(name) {
} else {
$dsp_progress = "";

if (!apiIsInvitedUser()) {
if (!api_is_invitee_user()) {
$dsp_progress = '<td>'.learnpath::get_progress_bar($progress, '%').'</td>';
}
}
Expand Down
4 changes: 2 additions & 2 deletions main/newscorm/lp_view.php
Expand Up @@ -255,7 +255,7 @@
LIMIT 1";
$res_last_attempt = Database::query($sql);

if (Database::num_rows($res_last_attempt) && !apiIsInvitedUser()) {
if (Database::num_rows($res_last_attempt) && !api_is_invitee_user()) {
$row_last_attempt = Database::fetch_row($res_last_attempt);
$lp_item_view_id = $row_last_attempt[0];
$sql = "UPDATE $TBL_LP_ITEM_VIEW SET
Expand Down Expand Up @@ -326,7 +326,7 @@
}

$progress_bar = "";
if (!apiIsInvitedUser()) {
if (!api_is_invitee_user()) {
$progress_bar = $_SESSION['oLP']->getProgressBar();
}
$navigation_bar = $_SESSION['oLP']->get_navigation_bar();
Expand Down
2 changes: 1 addition & 1 deletion main/work/upload.php
Expand Up @@ -48,7 +48,7 @@
$is_course_member = CourseManager::is_user_subscribed_in_real_or_linked_course($user_id, $course_code, $session_id);
$is_course_member = $is_course_member || api_is_platform_admin();

if ($is_course_member == false || apiIsInvitedUser()) {
if ($is_course_member == false || api_is_invitee_user()) {
api_not_allowed(true);
}

Expand Down
4 changes: 2 additions & 2 deletions main/work/work_list.php
Expand Up @@ -73,7 +73,7 @@

echo '<div class="actions">';
echo '<a href="'.api_get_path(WEB_CODE_PATH).'work/work.php?'.api_get_cidreq().'&origin='.$origin.'">'.Display::return_icon('back.png', get_lang('BackToWorksList'),'',ICON_SIZE_MEDIUM).'</a>';
if (api_is_allowed_to_session_edit(false, true) && !empty($workId) && !apiIsInvitedUser() ) {
if (api_is_allowed_to_session_edit(false, true) && !empty($workId) && !api_is_invitee_user() ) {
echo '<a href="'.api_get_path(WEB_CODE_PATH).'work/upload.php?'.api_get_cidreq().'&id='.$workId.'&origin='.$origin.'">';
echo Display::return_icon('upload_file.png', get_lang('UploadADocument'), '', ICON_SIZE_MEDIUM).'</a>';
}
Expand Down Expand Up @@ -112,7 +112,7 @@
echo $result['message'];
$check_qualification = intval($my_folder_data['qualification']);

if (!apiIsInvitedUser()) {
if (!api_is_invitee_user()) {
if (!empty($work_data['enable_qualification']) && !empty($check_qualification)) {
$type = 'simple';

Expand Down

0 comments on commit db49eca

Please sign in to comment.