public function getlist()
    {
        $id_category = Get::req('id_category', DOTY_INT, 0);
        $show_descendants = Get::req('descendants', DOTY_INT, 0) > 0;
        $start_index = Get::req('startIndex', DOTY_INT, 0);
        $results = Get::req('results', DOTY_MIXED, Get::sett('visuItem', 25));
        $sort = Get::req('sort', DOTY_MIXED, 'title');
        $dir = Get::req('dir', DOTY_MIXED, 'asc');
        $filter_text = Get::req('filter_text', DOTY_STRING, "");
        $filter = array('text' => $filter_text);
        $total_comm = $this->model->total($filter, $id_category, $show_descendants);
        $array_comm = $this->model->findAll($start_index, $results, $sort, $dir, $filter, $id_category, $show_descendants);
        $comm_id_arr = array();
        foreach ($array_comm as $key => $value) {
            $type = $array_comm[$key]['type_of'];
            if ($type == 'file') {
                $comm_id_arr[] = $value['id_comm'];
            }
        }
        require_once _lms_ . '/lib/lib.kbres.php';
        $kbres = new KbRes();
        $categorized_file_items = $kbres->getCategorizedResources($comm_id_arr, "file", "communication", true);
        $categorized_file_items_id = !empty($categorized_file_items) ? array_keys($categorized_file_items) : array();
        $list = array();
        foreach ($array_comm as $key => $value) {
            $array_comm[$key]['id'] = $value['id_comm'];
            if ($filter_text) {
                $array_comm[$key]['title'] = highlightText($value['title'], $filter_text);
                $array_comm[$key]['description'] = highlightText($value['description'], $filter_text);
            }
            $array_comm[$key]['publish_date'] = Format::date($value['publish_date'], 'date');
            $type = $array_comm[$key]['type_of'];
            if ($type == 'file' || $type == 'scorm') {
                if ($type == 'scorm' || in_array($value['id_comm'], $categorized_file_items_id)) {
                    $array_comm[$key]['categorize'] = '<a class="ico-sprite subs_categorize" title="' . Lang::t('_CATEGORIZE', 'kb') . '"
						href="index.php?r=alms/communication/categorize&id_comm=' . $value['id_comm'] . '"><span>' . Lang::t('_CATEGORIZE', 'kb') . '</span></a>';
                } else {
                    $array_comm[$key]['categorize'] = '<a class="ico-sprite fd_notice" title="' . Lang::t('_NOT_CATEGORIZED', 'kb') . '"
						href="index.php?r=alms/communication/categorize&id_comm=' . $value['id_comm'] . '"><span>' . Lang::t('_NOT_CATEGORIZED', 'kb') . '</span></a>';
                }
            } else {
                $array_comm[$key]['categorize'] = '';
            }
            if ($value['access_entity']) {
                $array_comm[$key]['user'] = '******' . Lang::t('_ASSIGN_USERS', 'communication') . '"
					href="index.php?r=alms/communication/mod_user&id_comm=' . $value['id_comm'] . '&load=1"><span>' . Lang::t('_ASSIGN_USERS', 'communication') . '</span></a>';
            } else {
                $array_comm[$key]['user'] = '******' . Lang::t('_NO_USER_SELECTED', 'communication') . '"
					href="index.php?r=alms/communication/mod_user&id_comm=' . $value['id_comm'] . '&load=1"><span>' . Lang::t('_ASSIGN_USERS', 'communication') . '</span></a>';
            }
            $array_comm[$key]['edit'] = '<a class="ico-sprite subs_mod" href="index.php?r=alms/communication/edit&id_comm=' . $value['id_comm'] . '"><span>' . Lang::t('_MOD', 'communication') . '</span></a>';
            $array_comm[$key]['del'] = 'ajax.adm_server.php?r=alms/communication/del&id_comm=' . $value['id_comm'];
        }
        $result = array('totalRecords' => $total_comm, 'startIndex' => $start_index, 'sort' => $sort, 'dir' => $dir, 'rowsPerPage' => $results, 'results' => count($array_comm), 'records' => $array_comm);
        $this->data = $this->json->encode($result);
        echo $this->data;
    }
Esempio n. 2
0
$data = array();
$sco_arr = array();
while ($row = mysql_fetch_assoc($q)) {
    $sco_id = $row["idscorm_item"];
    $sco_arr[] = $sco_id;
    $data[$i]["idscorm_item"] = $sco_id;
    $data[$i]["title"] = $row['title'];
    $url = 'index.php?r=alms/communication/categorize&amp;id_comm=' . $id_comm . '
			&amp;idResource=' . $id_resource . '&amp;sco_id=' . $sco_id;
    //.'&amp;comm_title='.$comm_data['title'];
    $data[$i]["url"] = $url;
    $i++;
}
require_once _lms_ . '/lib/lib.kbres.php';
$kbres = new KbRes();
$categorized_sco = $kbres->getCategorizedResources($sco_arr, "scoitem", "communication", true);
$categorized_sco_id = !empty($categorized_sco) ? array_keys($categorized_sco) : array();
foreach ($data as $row) {
    $line = array();
    $sco_id = $row["idscorm_item"];
    $line[] = $row['title'];
    $categorized = false;
    if (in_array($sco_id, $categorized_sco_id)) {
        $res_id = $categorized_sco[$sco_id]['res_id'];
        $line[] = $categorized_sco[$sco_id]['r_type'];
        $line[] = $categorized_sco[$sco_id]['r_env'];
        $line[] = $categorized_sco[$sco_id]['r_lang'];
        $line[] = isset($categorized_sco['tags'][$res_id]) ? implode(',', $categorized_sco['tags'][$res_id]) : '';
        $categorized = true;
    } else {
        array_push($line, '', '', '', '');
Esempio n. 3
0
$i = 0;
$data = array();
$sco_arr = array();
while ($row = mysql_fetch_assoc($q)) {
    $sco_id = $row["idscorm_item"];
    $sco_arr[] = $sco_id;
    $data[$i]["idscorm_item"] = $sco_id;
    $data[$i]["title"] = $row['title'];
    $url = 'index.php?r=alms/games/categorize&amp;id_game=' . $id_game . '
			&amp;idResource=' . $id_resource . '&amp;sco_id=' . $sco_id;
    $data[$i]["url"] = $url;
    $i++;
}
require_once _lms_ . '/lib/lib.kbres.php';
$kbres = new KbRes();
$categorized_sco = $kbres->getCategorizedResources($sco_arr, "scoitem", "games", true);
$categorized_sco_id = !empty($categorized_sco) ? array_keys($categorized_sco) : array();
foreach ($data as $row) {
    $line = array();
    $sco_id = $row["idscorm_item"];
    $line[] = $row['title'];
    $categorized = false;
    if (in_array($sco_id, $categorized_sco_id)) {
        $res_id = $categorized_sco[$sco_id]['res_id'];
        $line[] = $categorized_sco[$sco_id]['r_type'];
        $line[] = $categorized_sco[$sco_id]['r_env'];
        $line[] = $categorized_sco[$sco_id]['r_lang'];
        $line[] = isset($categorized_sco['tags'][$res_id]) ? implode(',', $categorized_sco['tags'][$res_id]) : '';
        $categorized = true;
    } else {
        array_push($line, '', '', '', '');
Esempio n. 4
0
function getScoItemsTable($id_org, $scormorg_title, $idItem)
{
    require_once _base_ . '/lib/lib.table.php';
    $tb = new Table(Get::sett('visu_course'));
    $id_org = (int) $id_org;
    $h_type = array('', '', '', '', '', 'image');
    $h_content = array(Lang::t('_NAME', 'organization'), Lang::t('_TYPE', 'kb'), Lang::t('_ENVIRONMENT', 'kb'), Lang::t('_LANGUAGE', 'kb'), Lang::t('_TAGS', 'kb'), Lang::t('_CATEGORIZE', 'kb'));
    $tb->setColsStyle($h_type);
    $tb->addHead($h_content);
    $qry = "SELECT t1.idscorm_item, t1.title " . " FROM " . $GLOBALS['prefix_lms'] . "_scorm_items as t1 " . " WHERE t1.idscorm_organization='" . $id_org . "'\r\n\t\t  AND t1.idscorm_resource != 0\r\n\t\t\tORDER BY t1.idscorm_item";
    $q = sql_query($qry);
    $i = 0;
    $data = array();
    $sco_arr = array();
    while ($row = mysql_fetch_assoc($q)) {
        $sco_id = $row["idscorm_item"];
        $sco_arr[] = $sco_id;
        $data[$i]["idscorm_item"] = $sco_id;
        $data[$i]["title"] = $row['title'];
        $url = 'index.php?modname=storage&amp;op=org_categorize_sco&amp;idItem=' . $idItem . '
			&amp;idResource=' . $id_org . '&amp;sco_id=' . $sco_id . '&amp;scormorg_title=' . $scormorg_title;
        $data[$i]["url"] = $url;
        $i++;
    }
    require_once _lms_ . '/lib/lib.kbres.php';
    $kbres = new KbRes();
    $categorized_sco = $kbres->getCategorizedResources($sco_arr, "scoitem", "course_lo", true);
    $categorized_sco_id = !empty($categorized_sco) ? array_keys($categorized_sco) : array();
    foreach ($data as $row) {
        $line = array();
        $sco_id = $row["idscorm_item"];
        $line[] = $row['title'];
        $categorized = false;
        if (in_array($sco_id, $categorized_sco_id)) {
            $res_id = $categorized_sco[$sco_id]['res_id'];
            $line[] = $categorized_sco[$sco_id]['r_type'];
            $line[] = $categorized_sco[$sco_id]['r_env'];
            $line[] = $categorized_sco[$sco_id]['r_lang'];
            $line[] = isset($categorized_sco['tags'][$res_id]) ? implode(',', $categorized_sco['tags'][$res_id]) : '';
            $categorized = true;
        } else {
            array_push($line, '', '', '', '');
        }
        if ($categorized) {
            $img = '<img src="' . getPathImage() . 'standard/categorize.png"
				alt="' . Lang::t('_CATEGORIZE', 'kb') . '"
				title="' . Lang::t('_CATEGORIZE', 'kb') . '" />';
            $line[] = '<a href="' . $row['url'] . '">' . $img . '</a>';
        } else {
            $line[] = '<a class="ico-sprite fd_notice" title="' . Lang::t('_NOT_CATEGORIZED', 'kb') . '"
				href="' . $row['url'] . '"><span>' . Lang::t('_NOT_CATEGORIZED', 'kb') . '</span></a>';
        }
        $tb->addBody($line);
    }
    return $tb->getTable();
}