当前位置: 首页>>代码示例>>PHP>>正文


PHP Indexer::queueAsync方法代码示例

本文整理汇总了PHP中Indexer::queueAsync方法的典型用法代码示例。如果您正苦于以下问题:PHP Indexer::queueAsync方法的具体用法?PHP Indexer::queueAsync怎么用?PHP Indexer::queueAsync使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Indexer的用法示例。


在下文中一共展示了Indexer::queueAsync方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: process_actions

/**
 * @brief  Process resource actions
 * @global type $tool_content
 * @global type $id
 * @global type $langResourceCourseUnitDeleted
 * @global type $langResourceUnitModified
 * @global type $course_id
 * @global type $course_code
 * @return string
 */
function process_actions()
{
    global $tool_content, $id, $langResourceCourseUnitDeleted, $langResourceUnitModified, $course_id, $course_code, $webDir;
    // update index and refresh course metadata
    require_once 'modules/search/indexer.class.php';
    require_once 'modules/course_metadata/CourseXML.php';
    if (isset($_REQUEST['edit'])) {
        $res_id = intval($_GET['edit']);
        if ($id = check_admin_unit_resource($res_id)) {
            return edit_res($res_id);
        }
    } elseif (isset($_REQUEST['edit_res_submit'])) {
        // edit resource
        $res_id = intval($_REQUEST['resource_id']);
        if ($id = check_admin_unit_resource($res_id)) {
            @($restitle = $_REQUEST['restitle']);
            $rescomments = purify($_REQUEST['rescomments']);
            $result = Database::get()->query("UPDATE course_weekly_view_activities SET\n                                        title = ?s,\n                                        comments = ?s\n                                        WHERE course_weekly_view_id = ?d AND id = ?d", $restitle, $rescomments, $id, $res_id);
            Indexer::queueAsync(Indexer::REQUEST_STORE, Indexer::RESOURCE_UNITRESOURCE, $res_id);
            Indexer::queueAsync(Indexer::REQUEST_STORE, Indexer::RESOURCE_COURSE, $course_id);
            CourseXMLElement::refreshCourse($course_id, $course_code);
        }
        $tool_content .= "<div class='alert alert-success'>{$langResourceUnitModified}</div>";
    } elseif (isset($_REQUEST['del'])) {
        // delete resource from course unit
        $res_id = intval($_GET['del']);
        if ($id = check_admin_unit_resource($res_id)) {
            Database::get()->query("DELETE FROM course_weekly_view_activities WHERE id = ?d", $res_id);
            Indexer::queueAsync(Indexer::REQUEST_REMOVE, Indexer::RESOURCE_UNITRESOURCE, $res_id);
            Indexer::queueAsync(Indexer::REQUEST_STORE, Indexer::RESOURCE_COURSE, $course_id);
            CourseXMLElement::refreshCourse($course_id, $course_code);
            $tool_content .= "<div class='alert alert-success'>{$langResourceCourseUnitDeleted}</div>";
        }
    } elseif (isset($_REQUEST['vis'])) {
        // modify visibility in text resources only
        $res_id = intval($_REQUEST['vis']);
        if ($id = check_admin_unit_resource($res_id)) {
            $vis = Database::get()->querySingle("SELECT `visible` FROM course_weekly_view_activities WHERE id = ?d", $res_id)->visible;
            $newvis = $vis == 1 ? 0 : 1;
            Database::get()->query("UPDATE course_weekly_view_activities SET visible = '{$newvis}' WHERE id = ?d", $res_id);
            Indexer::queueAsync(Indexer::REQUEST_STORE, Indexer::RESOURCE_UNITRESOURCE, $res_id);
            Indexer::queueAsync(Indexer::REQUEST_STORE, Indexer::RESOURCE_COURSE, $course_id);
            CourseXMLElement::refreshCourse($course_id, $course_code);
        }
    } elseif (isset($_REQUEST['down'])) {
        // change order down
        $res_id = intval($_REQUEST['down']);
        if ($id = check_admin_unit_resource($res_id)) {
            move_order('course_weekly_view_activities', 'id', $res_id, 'order', 'down', "course_weekly_view_id={$id}");
        }
    } elseif (isset($_REQUEST['up'])) {
        // change order up
        $res_id = intval($_REQUEST['up']);
        if ($id = check_admin_unit_resource($res_id)) {
            move_order('course_weekly_view_activities', 'id', $res_id, 'order', 'up', "course_weekly_view_id={$id}");
        }
    }
    return '';
}
开发者ID:kostastzo,项目名称:openeclass,代码行数:69,代码来源:functions.php

示例2: refresh

 /**
  * Refresh the hierarchy nodes (departments) that a course belongs to. All previous belonging
  * nodes get deleted and then refreshed with the ones given as array arguments.
  *
  * @param int   $id          - Id for a given course
  * @param array $departments - Array containing the node ids that the given course should belong to
  */
 public function refresh($id, $departments)
 {
     if ($departments != null) {
         Database::get()->query("DELETE FROM {$this->departmenttable} WHERE course = ?d", $id);
         foreach (array_unique($departments) as $key => $department) {
             Database::get()->query("INSERT INTO {$this->departmenttable} (course, department) VALUES (?d,?d)", $id, $department);
         }
     }
     // refresh index
     global $webDir;
     // required for indexer
     require_once 'modules/search/indexer.class.php';
     Indexer::queueAsync(Indexer::REQUEST_STORE, Indexer::RESOURCE_COURSE, $id);
     // refresh course metadata
     require_once 'modules/course_metadata/CourseXML.php';
     CourseXMLElement::refreshCourse($id, course_id_to_code($id));
 }
开发者ID:nikosv,项目名称:openeclass,代码行数:24,代码来源:course.class.php

示例3: draw

    exit;
}
if (isset($_POST['submit'])) {
    $message = $_POST['message'];
    $poster_ip = $_SERVER['REMOTE_ADDR'];
    $parent_post = $_POST['parent_post'];
    if (trim($message) == '') {
        $tool_content .= "\n                <div class='alert alert-warning'>{$langEmptyMsg}</div>\n                <p class='back'>&laquo; {$langClick} <a href='newtopic.php?course={$course_code}&amp;forum={$forum_id}'>{$langHere}</a> {$langReturnTopic}</p>";
        draw($tool_content, 2, null, $head_content);
        exit;
    }
    $time = date("Y-m-d H:i:s");
    $surname = addslashes($_SESSION['surname']);
    $givenname = addslashes($_SESSION['givenname']);
    $this_post = Database::get()->query("INSERT INTO forum_post (topic_id, post_text, poster_id, post_time, poster_ip, parent_post_id) VALUES (?d, ?s , ?d, ?t, ?s, ?d)", $topic, $message, $uid, $time, $poster_ip, $parent_post)->lastInsertID;
    Indexer::queueAsync(Indexer::REQUEST_STORE, Indexer::RESOURCE_FORUMPOST, $this_post);
    $forum_user_stats = Database::get()->querySingle("SELECT COUNT(*) as c FROM forum_post \n                        INNER JOIN forum_topic ON forum_post.topic_id = forum_topic.id\n                        INNER JOIN forum ON forum.id = forum_topic.forum_id\n                        WHERE forum_post.poster_id = ?d AND forum.course_id = ?d", $uid, $course_id);
    Database::get()->query("DELETE FROM forum_user_stats WHERE user_id = ?d AND course_id = ?d", $uid, $course_id);
    Database::get()->query("INSERT INTO forum_user_stats (user_id, num_posts, course_id) VALUES (?d,?d,?d)", $uid, $forum_user_stats->c, $course_id);
    Database::get()->query("UPDATE forum_topic SET topic_time = ?t,\n                    num_replies = num_replies+1,\n                    last_post_id = ?d\n\t\tWHERE id = ?d AND forum_id = ?d", $time, $this_post, $topic, $forum_id);
    $result = Database::get()->query("UPDATE forum SET num_posts = num_posts+1,\n                    last_post_id = ?d\n\t\tWHERE id = ?d\n                    AND course_id = ?d", $this_post, $forum_id, $course_id);
    if (!$result) {
        $tool_content .= $langErrorUpadatePostCount;
        draw($tool_content, 2, null, $head_content);
        exit;
    }
    // --------------------------------
    // notify users
    // --------------------------------
    $subject_notify = "{$logo} - {$langSubjectNotify}";
    $category_id = forum_category($forum_id);
开发者ID:kostastzo,项目名称:openeclass,代码行数:31,代码来源:reply.php

示例4: intval

         $res_id = intval(getDirectReference($_GET['del']));
         if (($id = check_admin_unit_resource($res_id))) {
             Database::get()->query("DELETE FROM course_weekly_view_activities WHERE id = ?d", $res_id);
             Indexer::queueAsync(Indexer::REQUEST_REMOVE, Indexer::RESOURCE_UNITRESOURCE, $res_id);
             Indexer::queueAsync(Indexer::REQUEST_STORE, Indexer::RESOURCE_COURSE, $course_id);
             CourseXMLElement::refreshCourse($course_id, $course_code);
             $tool_content .= "<div class='alert alert-success'>$langResourceCourseUnitDeleted</div>";
         }
     }
 } elseif (isset($_REQUEST['vis'])) { // modify visibility
     $id = intval(getDirectReference($_REQUEST['vis']));
     $vis = Database::get()->querySingle("SELECT `visible` FROM course_units WHERE id = ?d", $id)->visible;
     $newvis = ($vis == 1) ? 0 : 1;
     Database::get()->query("UPDATE course_units SET visible = ?d WHERE id = ?d AND course_id = ?d", $newvis, $id, $course_id);
     Indexer::queueAsync(Indexer::REQUEST_STORE, Indexer::RESOURCE_UNIT, $id);
     Indexer::queueAsync(Indexer::REQUEST_STORE, Indexer::RESOURCE_COURSE, $course_id);
     CourseXMLElement::refreshCourse($course_id, $course_code);
 } elseif (isset($_REQUEST['access'])) {
     if ($course_viewType == 'weekly') {
         $id = intval(getDirectReference($_REQUEST['access']));
         $access = Database::get()->querySingle("SELECT `public` FROM course_weekly_view WHERE id = ?d", $id);
         $newaccess = ($access->public == '1') ? '0' : '1';
         Database::get()->query("UPDATE course_weekly_view SET public = ?d WHERE id = ?d AND course_id = ?d", $newaccess, $id, $course_id);
     } else {
         $id = intval(getDirectReference($_REQUEST['access']));
         $access = Database::get()->querySingle("SELECT `public` FROM course_units WHERE id = ?d", $id);
         $newaccess = ($access->public == '1') ? '0' : '1';
         Database::get()->query("UPDATE course_units SET public = ?d WHERE id = ?d AND course_id = ?d", $newaccess, $id, $course_id);
     }
 } elseif (isset($_REQUEST['down'])) {
     $id = intval(getDirectReference($_REQUEST['down'])); // change order down
开发者ID:nikosv,项目名称:openeclass,代码行数:31,代码来源:course_home.php

示例5: redirect_to_home_page

                    Indexer::queueAsync(Indexer::REQUEST_STORE, Indexer::RESOURCE_EXERCISE, $exerciseId);
                    redirect_to_home_page('modules/exercise/index.php?course='.$course_code);
                case 'disable': // disables an exercise
                    $objExerciseTmp->disable();
                    $objExerciseTmp->save();
                    Indexer::queueAsync(Indexer::REQUEST_STORE, Indexer::RESOURCE_EXERCISE, $exerciseId);
                    redirect_to_home_page('modules/exercise/index.php?course='.$course_code);
                case 'public':  // make exercise public
                    $objExerciseTmp->makepublic();
                    $objExerciseTmp->save();
                    Indexer::queueAsync(Indexer::REQUEST_STORE, Indexer::RESOURCE_EXERCISE, $exerciseId);
                    redirect_to_home_page('modules/exercise/index.php?course='.$course_code);
                case 'limited':  // make exercise limited
                    $objExerciseTmp->makelimited();
                    $objExerciseTmp->save();
                    Indexer::queueAsync(Indexer::REQUEST_STORE, Indexer::RESOURCE_EXERCISE, $exerciseId);
                    redirect_to_home_page('modules/exercise/index.php?course='.$course_code);
                case 'clone':  // make exercise limited
                    $objExerciseTmp->duplicate();
                    Session::Messages($langCopySuccess, 'alert-success');
                    redirect_to_home_page('modules/exercise/index.php?course='.$course_code);              
            }
        }
        // destruction of Exercise
        unset($objExerciseTmp);
    }
    $result = Database::get()->queryArray("SELECT id, title, description, type, active, public, ip_lock, password_lock FROM exercise WHERE course_id = ?d ORDER BY id LIMIT ?d, ?d", $course_id, $from, $limitExPage);
    $qnum = Database::get()->querySingle("SELECT COUNT(*) as count FROM exercise WHERE course_id = ?d", $course_id)->count;
} else {
        $gids = user_group_info($uid, $course_id);
        if (!empty($gids)) {
开发者ID:nikosv,项目名称:openeclass,代码行数:31,代码来源:index.php

示例6: intval

     $stop_display = "0000-00-00";
 }
 if (!empty($_POST['id'])) {
     $id = intval($_POST['id']);
     Database::get()->query("UPDATE announcement SET content = ?s, title = ?s, `date` = " . DBHelper::timeAfter() . ", start_display = ?t, stop_display = ?t  WHERE id = ?d", $newContent, $antitle, $start_display, $stop_display, $id);
     $log_type = LOG_MODIFY;
     $message = "<div class='alert alert-success'>{$langAnnModify}</div>";
 } else {
     // add new announcement
     $orderMax = Database::get()->querySingle("SELECT MAX(`order`) AS maxorder FROM announcement\n                                                   WHERE course_id = ?d", $course_id)->maxorder;
     $order = $orderMax + 1;
     // insert
     $id = Database::get()->query("INSERT INTO announcement\n                                         SET content = ?s,\n                                             title = ?s, `date` = " . DBHelper::timeAfter() . ",\n                                             course_id = ?d, `order` = ?d,\n                                             visible = 1,\n                                             start_display = ?t,\n                                             stop_display = ?t", $newContent, $antitle, $course_id, $order, $start_display, $stop_display)->lastInsertID;
     $log_type = LOG_INSERT;
 }
 Indexer::queueAsync(Indexer::REQUEST_STORE, Indexer::RESOURCE_ANNOUNCEMENT, $id);
 $txt_content = ellipsize_html(canonicalize_whitespace(strip_tags($_POST['newContent'])), 50, '+');
 Log::record($course_id, MODULE_ID_ANNOUNCE, $log_type, array('id' => $id, 'email' => $send_mail, 'title' => $_POST['antitle'], 'content' => $txt_content));
 // send email
 if ($send_mail) {
     $recipients_emaillist = "";
     foreach ($_POST['recipients'] as $re) {
         $recipients_emaillist .= empty($recipients_emaillist) ? "'{$re}'" : ",'{$re}'";
     }
     $emailContent = "{$professorMessage}: " . q($_SESSION['givenname']) . " " . q($_SESSION['surname']) . "<br>\n<br>\n" . q($_POST['antitle']) . "<br>\n<br>\n" . $_POST['newContent'];
     $emailSubject = "{$professorMessage} ({$public_code} - " . q($title) . " - {$langAnnouncement})";
     // select students email list
     $countEmail = 0;
     $invalid = 0;
     $recipients = array();
     $emailBody = html2text($emailContent);
开发者ID:kostastzo,项目名称:openeclass,代码行数:31,代码来源:index.php

示例7: redirect_to_home_page

            $newVisibilityStatus = 0;
            $visibilityPath = $_GET['mkInvisibl'];
        }
        Database::get()->query("UPDATE document SET visible=?d\n                                          WHERE {$group_sql} AND\n                                                path = ?s", $newVisibilityStatus, $visibilityPath);
        $r = Database::get()->querySingle("SELECT id FROM document WHERE {$group_sql} AND path = ?s", $visibilityPath);
        Indexer::queueAsync(Indexer::REQUEST_STORE, Indexer::RESOURCE_DOCUMENT, $r->id);
        Session::Messages($langViMod, 'alert-success');
        redirect_to_home_page("modules/document/index.php?course={$course_code}");
    }
    // Public accessibility commands
    if (isset($_GET['public']) || isset($_GET['limited'])) {
        $new_public_status = intval(isset($_GET['public']));
        $path = isset($_GET['public']) ? $_GET['public'] : $_GET['limited'];
        Database::get()->query("UPDATE document SET public = ?d\n                                          WHERE {$group_sql} AND\n                                                path = ?s", $new_public_status, $path);
        $r = Database::get()->querySingle("SELECT id FROM document WHERE {$group_sql} AND path = ?s", $path);
        Indexer::queueAsync(Indexer::REQUEST_STORE, Indexer::RESOURCE_DOCUMENT, $r->id);
        $action_message = "<div class='alert alert-success'>{$langViMod}</div>";
    }
}
// teacher only
// Common for teachers and students
// define current directory
// Check if $var is set and return it - if $is_file, then return only dirname part
function pathvar(&$var, $is_file = false)
{
    static $found = false;
    if ($found) {
        return '';
    }
    if (isset($var)) {
        $found = true;
开发者ID:kostastzo,项目名称:openeclass,代码行数:31,代码来源:index.php

示例8: create_restored_course


//.........这里部分代码省略.........
                $video_map, $videolink_map, $assignments_map, $exercise_map, $ebook_map,
                $lp_learnPath_map),
            'delete' => array('id')
        ), $url_prefix_map, $backupData, $restoreHelper);

        // Units
        $unit_map = restore_table($restoreThis, 'course_units', array('set' => array('course_id' => $new_course_id), 'return_mapping' => 'id'), $url_prefix_map, $backupData, $restoreHelper);
        restore_table($restoreThis, 'unit_resources', array('delete' => array('id'),
            'map' => array('unit_id' => $unit_map),
            'map_function' => 'unit_map_function',
            'map_function_data' => array($document_map,
                $link_category_map,
                $link_map,
                $ebook_map,
                $ebook_section_map,
                $ebook_subsection_map,
                $video_map,
                $videolink_map,
                $lp_learnPath_map,
                $wiki_map,
                $assignments_map,
                $exercise_map,
                $forum_map,
                $forum_topic_map)
            ), $url_prefix_map, $backupData, $restoreHelper);

        // Weekly
        $weekly_map = restore_table($restoreThis, 'course_weekly_view', array(
            'set' => array('course_id' => $new_course_id),
            'return_mapping' => 'id'
            ), $url_prefix_map, $backupData, $restoreHelper);
        restore_table($restoreThis, 'course_weekly_view_activities', array(
            'delete' => array('id'),
            'map' => array('course_weekly_view_id' => $weekly_map),
            'map_function' => 'unit_map_function',
            'map_function_data' => array($document_map,
                $link_category_map,
                $link_map,
                $ebook_map,
                $ebook_section_map,
                $ebook_subsection_map,
                $video_map,
                $videolink_map,
                $lp_learnPath_map,
                $wiki_map,
                $assignments_map,
                $exercise_map,
                $forum_map,
                $forum_topic_map)
            ), $url_prefix_map, $backupData, $restoreHelper);

        restore_table($restoreThis, 'course_description', array(
            'set' => array('course_id' => $new_course_id),
            'delete' => array('id')
            ), $url_prefix_map, $backupData, $restoreHelper);

        removeDir($restoreThis);

        // index course after restoring
        require_once 'modules/search/indexer.class.php';
        Indexer::queueAsync(Indexer::REQUEST_REMOVEALLBYCOURSE, Indexer::RESOURCE_IDX, $new_course_id);
        Indexer::queueAsync(Indexer::REQUEST_STOREALLBYCOURSE, Indexer::RESOURCE_IDX, $new_course_id);
    });

    // check/cleanup video files after restore transaction
    if ($new_course_code != null && $new_course_id != null) {
        $videodir = $webDir . "/video/" . $new_course_code;
        $videos = scandir($videodir);
        foreach ($videos as $videofile) {
            if (is_dir($videofile)) {
                continue;
            }

            $vlike = '/' . $videofile;

            if (!isWhitelistAllowed($videofile)) {
                unlink($videodir . "/" . $videofile);
                Database::get()->query("DELETE FROM `video` WHERE course_id = ?d AND path LIKE ?s", $new_course_id, $vlike);
                continue;
            }

            $vcnt = Database::get()->querySingle("SELECT count(id) AS count FROM `video` WHERE course_id = ?d AND path LIKE ?s", $new_course_id, $vlike)->count;
            if ($vcnt <= 0) {
                unlink($videodir . "/" . $videofile);
            }
        }
        $backUrl = $urlAppend . (isset($currentCourseCode)? "courses/$currentCourseCode/": 'modules/admin/');
        $tool_content .= action_bar(array(
            array('title' => $langEnter,
                  'url' => $urlAppend . "courses/$new_course_code/",
                  'icon' => 'fa-arrow-right',
                  'level' => 'primary-label',
                  'button-class' => 'btn-success'),
            array('title' => $langBack,
                  'url' => $backUrl,
                  'icon' => 'fa-reply',
                  'level' => 'primary-label')), false);

    }
}
开发者ID:nikosv,项目名称:openeclass,代码行数:101,代码来源:restore_functions.php

示例9: process_actions

/**
 * @brief  Process resource actions
 * @global type $tool_content
 * @global type $id
 * @global type $langResourceCourseUnitDeleted
 * @global type $langResourceUnitModified
 * @global type $course_id
 * @global type $course_code
 * @return string
 */
function process_actions() {
    global $tool_content, $id, $langResourceCourseUnitDeleted, $langResourceUnitModified,
    $course_id, $course_code, $webDir, $cnt, $langBack, $urlAppend, $head_content;

    // update index and refresh course metadata
    require_once 'modules/search/indexer.class.php';
    require_once 'modules/course_metadata/CourseXML.php';

    if (isset($_REQUEST['edit'])) {
        $res_id = intval($_GET['edit']);
        if ($id = check_admin_unit_resource($res_id)) {
            $tool_content .= action_bar(array(
                array(
                    'title' => $langBack,
                    'url' => "{$urlAppend}modules/weeks/index.php?course=$course_code&amp;id=$id&amp;cnt=$cnt",
                    'icon' => 'fa-reply',
                    'level' => 'primary-label')));
            $tool_content .= edit_res($res_id);
            draw($tool_content, 2, null, $head_content);
            exit;            
        }
    } elseif (isset($_REQUEST['edit_res_submit'])) { // edit resource
        $res_id = intval($_REQUEST['resource_id']);
        if ($id = check_admin_unit_resource($res_id)) {
            @$restitle = $_REQUEST['restitle'];
            $rescomments = purify($_REQUEST['rescomments']);
            $result = Database::get()->query("UPDATE course_weekly_view_activities SET
                                        title = ?s,
                                        comments = ?s
                                        WHERE course_weekly_view_id = ?d AND id = ?d", $restitle, $rescomments, $id, $res_id);
            Indexer::queueAsync(Indexer::REQUEST_STORE, Indexer::RESOURCE_UNITRESOURCE, $res_id);
            Indexer::queueAsync(Indexer::REQUEST_STORE, Indexer::RESOURCE_COURSE, $course_id);
            CourseXMLElement::refreshCourse($course_id, $course_code);
            redirect_to_home_page("modules/weeks/index.php?course=$course_code&id=$id&cnt=$cnt");
        }
        $tool_content .= "<div class='alert alert-success'>$langResourceUnitModified</div>";
    } elseif (isset($_REQUEST['del'])) { // delete resource from course unit
        $res_id = intval($_GET['del']);
        if ($id = check_admin_unit_resource($res_id)) {
            Database::get()->query("DELETE FROM course_weekly_view_activities WHERE id = ?d", $res_id);            
            Indexer::queueAsync(Indexer::REQUEST_REMOVE, Indexer::RESOURCE_UNITRESOURCE, $res_id);
            Indexer::queueAsync(Indexer::REQUEST_STORE, Indexer::RESOURCE_COURSE, $course_id);
            CourseXMLElement::refreshCourse($course_id, $course_code);
            Session::Messages($langResourceCourseUnitDeleted, 'alert-success');
            redirect_to_home_page("modules/weeks/index.php?course=$course_code&id=$id&cnt=$cnt");
        }
    } elseif (isset($_REQUEST['vis'])) { // modify visibility in text resources only
        $res_id = intval($_REQUEST['vis']);
        if ($id = check_admin_unit_resource($res_id)) {            
            $vis = Database::get()->querySingle("SELECT `visible` FROM course_weekly_view_activities WHERE id = ?d", $res_id)->visible;            
            $newvis = ($vis == 1) ? 0 : 1;
            Database::get()->query("UPDATE course_weekly_view_activities SET visible = '$newvis' WHERE id = ?d", $res_id);
            Indexer::queueAsync(Indexer::REQUEST_STORE, Indexer::RESOURCE_UNITRESOURCE, $res_id);
            Indexer::queueAsync(Indexer::REQUEST_STORE, Indexer::RESOURCE_COURSE, $course_id);
            CourseXMLElement::refreshCourse($course_id, $course_code);
            redirect_to_home_page("modules/weeks/index.php?course=$course_code&id=$id&cnt=$cnt");
        }
    } elseif (isset($_REQUEST['down'])) { // change order down
        $res_id = intval($_REQUEST['down']);
        if ($id = check_admin_unit_resource($res_id)) {
            move_order('course_weekly_view_activities', 'id', $res_id, 'order', 'down', "course_weekly_view_id=$id");
            redirect_to_home_page("modules/weeks/index.php?course=$course_code&id=$id&cnt=$cnt");
        }
    } elseif (isset($_REQUEST['up'])) { // change order up
        $res_id = intval($_REQUEST['up']);
        if ($id = check_admin_unit_resource($res_id)) {
            move_order('course_weekly_view_activities', 'id', $res_id, 'order', 'up', "course_weekly_view_id=$id");
            redirect_to_home_page("modules/weeks/index.php?course=$course_code&id=$id&cnt=$cnt");
        }
    }
    return '';
}
开发者ID:nikosv,项目名称:openeclass,代码行数:82,代码来源:functions.php

示例10: delete_link

/**
 * @brief delete link
 * @global type $course_id
 * @global type $langLinkDeleted
 * @param type $id
 */
function delete_link($id) {
    global $course_id, $langLinkDeleted;

    $tuple = Database::get()->querySingle("SELECT url, title, category FROM link WHERE course_id = ?d AND id = ?d", $course_id, $id);
    $url = $tuple->url;
    $title = $tuple->title;
    $category = $tuple->category;
    if ($category == -2) { //delete abuse reports and ratings for social bookmark
        Database::get()->query("DELETE abuse_report FROM abuse_report INNER JOIN `link` ON `link`.id = abuse_report.rid
                               WHERE abuse_report.rtype = ?s AND abuse_report.rid = ?d", 'link', $id);
        Database::get()->query("DELETE rating FROM rating INNER JOIN `link` ON `link`.id = rating.rid
                                WHERE rating.rtype = ?s AND rating.rid = ?d", 'link', $id);
        Database::get()->query("DELETE rating_cache FROM rating_cache INNER JOIN `link` ON `link`.id = rating_cache.rid
                                WHERE rating_cache.rtype = ?s AND rating_cache.rid = ?d", 'link', $id);
        
    }
    Database::get()->query("DELETE FROM `link` WHERE course_id = ?d AND id = ?d", $course_id, $id);
    Indexer::queueAsync(Indexer::REQUEST_REMOVE, Indexer::RESOURCE_LINK, $id);
    Log::record($course_id, MODULE_ID_LINKS, LOG_DELETE, array('id' => $id,
                                                               'url' => $url,
                                                               'title' => $title));
}
开发者ID:nikosv,项目名称:openeclass,代码行数:28,代码来源:linkfunctions.php

示例11: storeDelosResources

function storeDelosResources($jsonObj) {
    global $course_id;
    $submittedResources = $_POST['delosResources'];
    $submittedCategory = $_POST['selectcategory'];

    foreach ($submittedResources as $rid) {
        $stored = Database::get()->querySingle("SELECT id 
            FROM videolink 
            WHERE course_id = ?d 
            AND category = ?d 
            AND url LIKE '%rid=" . $rid . "'", $course_id, $submittedCategory);
        foreach ($jsonObj->resources as $resource) {
            if ($resource->resourceID === $rid) {
                $vL = $resource->videoLecture;
                $url = $jsonObj->playerBasePath . '?rid=' . $rid;
                $title = $vL->title;
                $description = $vL->description;
                $creator = $vL->rights->creator->name;
                $publisher = $vL->organization->name;
                $date = $vL->date;

                if ($stored) {
                    $id = $stored->id;
                    $q = Database::get()->query("UPDATE videolink SET 
                        url = ?s, title = ?s, description = ?s, creator = ?s, publisher = ?s, date = ?t 
                        WHERE course_id = ?d 
                        AND category = ?d 
                        AND id = ?d", canonicalize_url($url), $title, $description, $creator, $publisher, $date, $course_id, $submittedCategory, $id);
                } else {
                    $q = Database::get()->query('INSERT INTO videolink (course_id, url, title, description, category, creator, publisher, date)
                        VALUES (?d, ?s, ?s, ?s, ?d, ?s, ?s, ?t)', $course_id, canonicalize_url($url), $title, $description, $submittedCategory, $creator, $publisher, $date);
                    $id = $q->lastInsertID;
                }
                Indexer::queueAsync(Indexer::REQUEST_STORE, Indexer::RESOURCE_VIDEOLINK, $id);
                $txt_description = ellipsize(canonicalize_whitespace(strip_tags($description)), 50, '+');
                Log::record($course_id, MODULE_ID_VIDEO, LOG_INSERT, array('id' => $id,
                    'url' => canonicalize_url($url),
                    'title' => $title,
                    'description' => $txt_description));
            }
        }
    }
}
开发者ID:nikosv,项目名称:openeclass,代码行数:43,代码来源:delos_functions.php

示例12: delete_video

/**
 * @brief delete video / videolink
 * @global type $course_id
 * @global type $webDir
 * @param type $id
 * @param type $table
 */
function delete_video($id, $table) {
    global $course_id, $course_code, $webDir;

    $myrow = Database::get()->querySingle("SELECT * FROM $table WHERE course_id = ?d AND id = ?d", $course_id, $id);
    $title = $myrow->title;
    if ($table == "video") {
        unlink("$webDir/video/$course_code/" . $myrow->path);
    }
    Database::get()->query("DELETE FROM $table WHERE course_id = ?d AND id = ?d", $course_id, $id);
    if ($table == 'video') {
        Indexer::queueAsync(Indexer::REQUEST_REMOVE, Indexer::RESOURCE_VIDEO, $id);
    } else {
        Indexer::queueAsync(Indexer::REQUEST_REMOVE, Indexer::RESOURCE_VIDEOLINK, $id);
    }
    Log::record($course_id, MODULE_ID_VIDEO, LOG_DELETE, array('id' => $id, 'title' => $title));
}
开发者ID:nikosv,项目名称:openeclass,代码行数:23,代码来源:index.php

示例13: delete_all_notes

 /**
  * Delete all notes of a given user and logs the action
  * @param int $user_id if empty the session user is assumed
  */
 public static function delete_all_notes($user_id = NULL){
     global $uid;
     Database::get()->query("DELETE FROM note WHERE user_id = ?d", $uid);
     Indexer::queueAsync(Indexer::REQUEST_REMOVEBYUSER, Indexer::RESOURCE_NOTE, $uid);
     Log::record(0, MODULE_ID_NOTES, LOG_DELETE, array('user_id' => $uid, 'id' => 'all'));
 }
开发者ID:nikosv,项目名称:openeclass,代码行数:10,代码来源:notes.class.php

示例14: insert_common_docs

/**
 * @brief insert common docs
 * @global type $course_id
 * @global type $course_code
 * @global string $group_sql
 * @param type $file
 * @param type $target_dir
 */
function insert_common_docs($file, $target_dir) {
    global $course_id, $course_code, $group_sql;

    $common_docs_dir_map = array();

    if ($file->format == '.dir') {
        $target_dir = make_path($target_dir, array($file->filename));
        $r = Database::get()->querySingle("SELECT id FROM document WHERE $group_sql AND path = ?s", $target_dir);
        Indexer::queueAsync(Indexer::REQUEST_STORE, Indexer::RESOURCE_DOCUMENT, $r->id);
        $common_docs_dir_map[$file->path] = $target_dir;
        $q = Database::get()->queryArray("SELECT * FROM document
                                      WHERE course_id = -1 AND
                                            subsystem = " . COMMON . " AND
                                            path LIKE ?s
                                      ORDER BY path", $file->path . '/%');
        foreach ($q as $file) {
            $new_target_dir = $common_docs_dir_map[dirname($file->path)];
            if ($file->format == '.dir') {
                $new_dir = make_path($new_target_dir, array($file->filename));
                $r2 = Database::get()->querySingle("SELECT id FROM document WHERE $group_sql AND path = ?s", $new_dir);
                Indexer::queueAsync(Indexer::REQUEST_STORE, Indexer::RESOURCE_DOCUMENT, $r2->id);
                $common_docs_dir_map[$file->path] = $new_dir;
            } else {
                insert_common_docs($file, $new_target_dir);
            }
        }
    } else {
        $path = preg_replace('|^.*/|', $target_dir . '/', $file->path);
        if ($file->extra_path) {
            $extra_path = $file->extra_path;
        } else {
            $extra_path = "common:$file->path";
        }
        $q = Database::get()->query("INSERT INTO document SET
                                course_id = ?d,
                                subsystem = " . MAIN . ",
                                path = ?s,
                                extra_path = ?s,
                                filename = ?s,
                                visible = 1,
                                comment = ?s,
                                title =	?s,
                                date = " . DBHelper::timeAfter() . ",
                                date_modified =	" . DBHelper::timeAfter() . ",
                                format = ?s", $course_id, $path, $extra_path, $file->filename, $file->comment, $file->title, $file->format);
        $id = $q->lastInsertID;
        Indexer::queueAsync(Indexer::REQUEST_STORE, Indexer::RESOURCE_DOCUMENT, $id);
    }
}
开发者ID:nikosv,项目名称:openeclass,代码行数:57,代码来源:insert.php

示例15: handle_unit_info_edit

/**
 * 
 * @global type $langCourseUnitModified
 * @global type $langCourseUnitAdded
 * @global null $maxorder
 * @global type $course_id
 * @global type $course_code
 * @global type $webDir
 * @return type
 */
function handle_unit_info_edit()
{
    global $langCourseUnitModified, $langCourseUnitAdded, $maxorder, $course_id, $course_code, $webDir;
    $title = $_REQUEST['unittitle'];
    $descr = $_REQUEST['unitdescr'];
    if (isset($_REQUEST['unit_id'])) {
        // update course unit
        $unit_id = $_REQUEST['unit_id'];
        Database::get()->query("UPDATE course_units SET\n                                        title = ?s,\n                                        comments = ?s\n                                    WHERE id = ?d AND course_id = ?d", $title, $descr, $unit_id, $course_id);
        $successmsg = $langCourseUnitModified;
    } else {
        // add new course unit
        $order = $maxorder + 1;
        $q = Database::get()->query("INSERT INTO course_units SET\n                                  title = ?s, comments = ?s, visible = 1,\n                                 `order` = ?d, course_id = ?d", $title, $descr, $order, $course_id);
        $successmsg = $langCourseUnitAdded;
        $unit_id = $q->lastInsertID;
    }
    // update index
    require_once 'modules/search/indexer.class.php';
    Indexer::queueAsync(Indexer::REQUEST_STORE, Indexer::RESOURCE_UNIT, $unit_id);
    Indexer::queueAsync(Indexer::REQUEST_STORE, Indexer::RESOURCE_COURSE, $course_id);
    // refresh course metadata
    require_once 'modules/course_metadata/CourseXML.php';
    CourseXMLElement::refreshCourse($course_id, $course_code);
    return "<div class='alert alert-success'>{$successmsg}</div>";
}
开发者ID:kostastzo,项目名称:openeclass,代码行数:36,代码来源:main_lib.php


注:本文中的Indexer::queueAsync方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。