function get_next_row()
 {
     if ($this->data === false) {
         $pdr = new PeopleDataRetriever($GLOBALS['dbConn'], $GLOBALS['prefix_fw']);
         if ($this->tree != 0) {
             //list($this->tree_desc) = $this->tree_view->tdb->getDescendantsSTFromST(array($this->tree));
             $pdr->setGroupFilter($this->tree, true);
         }
         $this->data = $pdr->getRows();
     }
     $row = sql_fetch_row($this->data);
     //print_r($row);
     if ($row == false) {
         $this->eof = true;
         return false;
     }
     $export = array();
     //find user field value
     foreach ($this->simplecols as $field_id => $name) {
         if (is_numeric($field_id)) {
             $pluto = $this->fl->fieldValue((int) $field_id, array($row[0]));
             list(, $export[]) = each($pluto);
         } else {
             switch ($field_id) {
                 case "userid":
                     $export[] = substr($row[1], 1);
                     break;
                 case "firstname":
                     $export[] = $row[2];
                     break;
                 case "lastname":
                     $export[] = $row[3];
                     break;
                 case "pass":
                     $export[] = '';
                     break;
                 case "email":
                     $export[] = $row[4];
                     break;
                 case "signature":
                     $export[] = $row[6];
                     break;
             }
         }
     }
     $this->index++;
     return $export;
 }
示例#2
0
 function loadPeopleView($url = '')
 {
     //checkPerm('view_user', false, 'directory', 'framework');
     $data = new PeopleDataRetriever($GLOBALS['dbConn'], $GLOBALS['prefix_fw']);
     $rend = new Table(Get::sett('visuUser'));
     $lv = new PeopleListView('', $data, $rend, 'pepledirectory');
     if ($this->nFields !== FALSE) {
         $lv->setNFields($this->nFields);
     }
     if ($this->show_simple_filter !== FALSE) {
         $lv->show_simple_filter = TRUE;
     }
     if ($this->lms_editions_filter !== FALSE) {
         $lv->lms_editions_filter = TRUE;
     }
     if ($this->hide_anonymous !== FALSE) {
         $lv->hide_anonymous = TRUE;
     }
     if ($this->hide_suspend !== TRUE) {
         $lv->hide_suspend = FALSE;
     }
     if ($url == '') {
         $url = "index.php?modname=directory&op=listuser";
     }
     $lv->setLinkPagination($url);
     $lv->aclManager =& $this->aclManager;
     $lv->selector_mode = $this->selector_mode;
     $lv->select_all = $this->select_all;
     $lv->deselect_all = $this->deselect_all;
     $lv->use_multi_sel = $this->use_multi_sel;
     $lv->sel_extend = $this->sel_extend;
     $lv->idModule = 'directory_selector';
     if ($this->selector_mode === FALSE) {
         $lv->setInsNew(TRUE);
     }
     $lv->parsePositionData($_POST);
     $lv->itemSelectedMulti = $this->selection;
     if ($lv->getOp() == 'newitem') {
         $this->editPerson();
     } elseif ($lv->getOp() == 'editperson') {
         $this->editPerson($lv->getIdSelectedItem());
     } elseif ($lv->getOp() == 'deleteperson') {
         $this->deletePerson($lv->getIdSelectedItem());
     } elseif ($lv->getOp() == 'suspendperson') {
         $this->suspendPerson($lv->getIdSelectedItem());
         $GLOBALS['page']->add(getResultUi($this->lang->def('_SUSPENDED')));
     } elseif ($lv->getOp() == 'recoverperson') {
         $this->recoverPerson($lv->getIdSelectedItem());
         $GLOBALS['page']->add(getResultUi($this->lang->def('_REACTIVATED_USER')));
     } else {
         if (!$this->selector_mode) {
             $GLOBALS['page']->add(getTitleArea($this->lang->def('_USERS'), 'directory_people'), 'content');
             $GLOBALS['page']->add('<div class="std_block">', 'content');
             $GLOBALS['page']->addEnd('</div>', 'content');
             $GLOBALS['page']->add('<form id="dirctory_listpeople" action="index.php?modname=directory&amp;op=listuser" method="post">' . '<input type="hidden" id="authentic_request_listpeople" name="authentic_request" value="' . Util::getSignature() . '" />', 'content');
             $GLOBALS['page']->addEnd('</form>', 'content');
         }
         if (isset($this->user_filter['exclude'])) {
             $data->addNotFilter($this->user_filter['exclude']);
         }
         if (isset($this->user_filter['user'])) {
             $data->setUserFilter($this->user_filter['user']);
         }
         if (isset($this->user_filter['group'])) {
             foreach ($this->user_filter['group'] as $idstGroup) {
                 $data->setGroupFilter($idstGroup);
             }
         } else {
             $userlevelid = Docebo::user()->getUserLevelId();
             if ($userlevelid != ADMIN_GROUP_GODADMIN) {
                 require_once $GLOBALS['where_framework'] . '/lib/lib.adminmanager.php';
                 $adminManager = new AdminManager();
                 $data->intersectGroupFilter($adminManager->getAdminTree(Docebo::user()->getIdSt()));
             }
         }
         // print out the listview
         $GLOBALS['page']->add($lv->printOut(), 'content');
     }
 }