Exemplo n.º 1
0
 function get_country_item_display($column, $item)
 {
     static $countries;
     if (!isset($countries)) {
         $countries = cm_get_list_of_countries();
     }
     return isset($countries[$item->country]) ? $countries[$item->country] : '';
 }
Exemplo n.º 2
0
 /**
  * Get the data to display for this table page.
  *
  * @param bool $download Flag to not include HTML for report download.
  * @return array An array of data records.
  */
 function get_data($download = false)
 {
     global $CURMAN, $CFG, $USER;
     /// Don't include users with the 'groupleader' role at the site level.
     $context = get_context_instance(CONTEXT_SYSTEM, SITEID);
     $procid = get_field('role', 'id', 'shortname', 'groupleader');
     $LIKE = $CURMAN->db->sql_compare();
     if ($CURMAN->db->_dbconnection->databaseType == 'postgres7') {
         $FULLNAME = 'usr.firstname || \' \' || COALESCE(usr.mi, \'\') || \' \' || usr.lastname';
     } else {
         $FULLNAME = 'CONCAT(usr.firstname,\' \',IFNULL(usr.mi, \'\'),\' \',usr.lastname)';
     }
     $cselect = 'SELECT COUNT(DISTINCT usr.id) ';
     $select = "SELECT usr.id as id,\n                           usr.idnumber as idnumber,\n                           usr.email as email,\n                           MAX(usr.timecreated) as timecreated,\n                           usr.birthdate as birthdate,\n                           usr.gender as gender,\n                           usr.country as country,\n                           clst.name as clustername,\n                           MAX(clsgrd.timegraded) as timegraded,\n                           {$FULLNAME} as student,\n                           curass.curriculumid as curriculumid,\n                           cras1.curriculumid as cras1id, cras2.curriculumid as cras2id, cras3.curriculumid as cras3id\n                   ";
     $tables = "FROM " . $CURMAN->db->prefix_table(USRTABLE) . " usr\n                    LEFT JOIN {$CFG->prefix}user mu ON mu.idnumber = usr.idnumber\n                    LEFT JOIN {$CFG->prefix}role_assignments ra ON (ra.roleid = {$procid}) AND ra.contextid = {$context->id} AND ra.userid = mu.id\n                    LEFT JOIN " . $CURMAN->db->prefix_table(CLSGRTABLE) . " clsgrd ON clsgrd.userid = usr.id\n                    LEFT JOIN " . $CURMAN->db->prefix_table(CLSTUSERTABLE) . " uclst ON uclst.userid = usr.id\n                    LEFT JOIN " . $CURMAN->db->prefix_table(CLSTTABLE) . " clst ON clst.id = uclst.clusterid\n                    LEFT JOIN " . $CURMAN->db->prefix_table(CURASSTABLE) . " curass ON curass.userid = usr.id\n                    LEFT JOIN " . $CURMAN->db->prefix_table(CURASSTABLE) . " cras1 ON cras1.userid = usr.id\n                    LEFT JOIN " . $CURMAN->db->prefix_table(CURASSTABLE) . " cras2 ON cras2.userid = usr.id AND (cras2.id != cras1.id)\n                    LEFT JOIN " . $CURMAN->db->prefix_table(CURASSTABLE) . " cras3 ON cras3.userid = usr.id AND (cras3.id != cras1.id) AND (cras3.id != cras2.id)\n                   ";
     $timenow = time();
     $yearago = $timenow - 365 * 24 * 60 * 60;
     $yearagostr = date('Y/m/d', $yearago);
     $where = "(ra.id IS NULL) ";
     $group = "GROUP BY usr.id ";
     if (!has_capability('block/curr_admin:viewreports', $context)) {
         if (has_capability('block/curr_admin:viewgroupreports', $context)) {
             $clstid = get_field(CLSTUSERTABLE, 'clusterid', 'userid', cm_get_crlmuserid($USER->id));
             $where .= "AND (uclst.clusterid = {$clstid}) ";
         }
     }
     if ($this->extrasql) {
         $where .= (!empty($where) ? ' AND ' : '') . $this->extrasql . ' ';
     }
     if (!empty($where)) {
         $where = 'WHERE ' . $where . ' ';
     }
     if (!empty($this->sort)) {
         $sort = 'ORDER BY ' . $this->sort . ' ' . $this->dir . ' ';
     } else {
         $sort = '';
     }
     if (!empty($this->perpage)) {
         if ($CURMAN->db->_dbconnection->databaseType == 'postgres7') {
             $limit = 'LIMIT ' . $this->perpage . ' OFFSET ' . $this->page * $this->perpage;
         } else {
             $limit = 'LIMIT ' . $this->page * $this->perpage . ', ' . $this->perpage;
         }
     } else {
         $limit = '';
     }
     /// Count the total number of results.
     $sql = $cselect . $tables . $where;
     $this->numrecs = $CURMAN->db->count_records_sql($sql);
     /// Get the current 'page' of results.
     $sql = $select . $tables . $where . $group . $sort . $limit;
     $this->data = $CURMAN->db->get_records_sql($sql);
     $context = get_context_instance(CONTEXT_SYSTEM, SITEID);
     if (!empty($this->data)) {
         $curricula = get_records(CURTABLE);
         $countries = cm_get_list_of_countries();
         foreach ($this->data as $di => $datum) {
             $datum->currentclassid = 0;
             $datum->currentclass = '';
             $datum->lastclassid = 0;
             $datum->lastclass = '';
             $context = get_context_instance(CONTEXT_SYSTEM, SITEID);
             $timenow = time();
             if (!$download) {
                 //                  if (has_capability('block/curr_admin:viewlocationusers', $context)) {
                 $datum->student = '<a href="index.php?s=rep&amp;section=rept&amp;type=' . 'induser&amp;frompage=enrol&amp;user='******'">' . $datum->student . '</a>';
                 //                  }
             }
             if ($datum->timecreated > 0) {
                 $datum->origenroldate = cm_timestamp_to_date($datum->timecreated);
             } else {
                 $datum->origenroldate = get_string('unknown', 'block_curr_admin');
             }
             $datum->birthdate = cm_timestring_to_date($datum->birthdate);
             $datum->timegraded = $datum->timegraded > 0 ? cm_timestamp_to_date($datum->timegraded) : '';
             switch ($datum->gender) {
                 case 'M':
                 case 'm':
                     $datum->gender = get_string('male', 'block_curr_admin');
                     break;
                 case 'F':
                 case 'f':
                     $datum->gender = get_string('female', 'block_curr_admin');
                     break;
                 default:
                     $datum->gender = get_string('unknown', 'block_curr_admin');
                     break;
             }
             $datum->curricula = '';
             if (!empty($datum->cras1id)) {
                 $datum->curricula .= $curricula[$datum->cras1id]->name;
             }
             if (!empty($datum->cras2id)) {
                 $datum->curricula .= !empty($datum->curricula) ? ',' : '' . $curricula[$datum->cras2id]->name;
             }
             if (!empty($datum->cras3id)) {
                 $datum->curricula .= !empty($datum->curricula) ? ',' : '' . $curricula[$datum->cras3id]->name;
             }
             if (!empty($datum->country) && isset($countries[$datum->country])) {
                 $datum->country = $countries[$datum->country];
             }
             $this->data[$di] = $datum;
         }
     }
 }
Exemplo n.º 3
0
 /**
  * Creates known user filter if present
  *
  * @uses $CURMAN
  * @uses $USER
  * @param string $fieldname
  * @param boolean $advanced
  * @return object filter
  */
 function get_field($fieldname, $advanced)
 {
     global $CURMAN, $USER;
     switch ($fieldname) {
         case 'username':
             return new user_filter_text('username', get_string('username'), $advanced, 'usr.username');
         case 'realname':
             return new cm_user_filter_text_OR('realname', get_string('fullname'), $advanced, 'fullname', array(sql_concat('usr.firstname', "' '", "COALESCE(usr.mi, '')", "' '", 'usr.lastname'), sql_concat('usr.firstname', "' '", 'usr.lastname')));
         case 'lastname':
             return new user_filter_text('lastname', get_string('lastname'), $advanced, 'usr.lastname');
         case 'firstname':
             return new user_filter_text('firstname', get_string('firstname'), $advanced, 'usr.firstname');
         case 'idnumber':
             return new user_filter_text('idnumber', get_string('idnumber'), $advanced, 'usr.idnumber');
         case 'email':
             return new user_filter_text('email', get_string('email'), $advanced, 'usr.email');
         case 'city':
             return new user_filter_text('city', get_string('city'), $advanced, 'usr.city');
         case 'country':
             return new user_filter_select('country', get_string('country'), $advanced, 'country', cm_get_list_of_countries(), $USER->country);
         case 'timecreated':
             return new user_filter_date('timecreated', get_string('createtime', 'block_curr_admin'), $advanced, 'usr.timecreated');
         case 'language':
             return new user_filter_select('language', get_string('preferredlanguage', 'block_curr_admin'), $advanced, 'usr.language', cm_get_list_of_languages());
         case 'clusterid':
             //obtain a mapping of cluster ids to names for all clusters
             $clusters = cm_get_list_of_clusters();
             //use a special filter class to filter users based on clusters
             return new cm_user_cluster_filter('clusterid', get_string('usercluster', 'block_curr_admin'), $advanced, 'usr.id', $clusters);
         case 'curriculumid':
             //obtain a mapping of curriculum ids to names for all curricula
             $choices = curriculum_get_menu();
             //use a special filter class to filter users based on curricula
             return new cm_user_curriculum_filter('curriculumid', get_string('usercurricula', 'block_curr_admin'), $advanced, 'usr.id', $choices);
         case 'inactive':
             $inactive_options = array(get_string('o_active', 'block_curr_admin'), get_string('all'), get_string('o_inactive', 'block_curr_admin'));
             return new cm_show_inactive_filter('inactive', get_string('showinactive', 'block_curr_admin'), $advanced, 'usr.inactive', $inactive_options);
         default:
             if (strncmp($fieldname, 'field_', 6) === 0) {
                 $f = substr($fieldname, 6);
                 $rec = new field($CURMAN->db->get_record(FIELDTABLE, 'shortname', $f));
                 return new cm_custom_field_filter($fieldname, $rec->shortname, $advanced, $rec);
             }
             return null;
     }
 }
Exemplo n.º 4
0
 public function definition()
 {
     global $USER, $CFG, $COURSE;
     if ($this->_customdata['obj']) {
         $this->set_data($this->_customdata['obj']);
         $disabled = true;
     } else {
         $disabled = false;
     }
     $mform =& $this->_form;
     $strgeneral = get_string('general');
     $strrequired = get_string('required');
     $bundle = NULL;
     /// Add some extra hidden fields
     $mform->addElement('hidden', 'id');
     $mform->addElement('hidden', 'search');
     $mform->addElement('text', 'idnumber', get_string('idnumber'));
     $mform->setType('idnumber', PARAM_TEXT);
     $mform->addRule('idnumber', null, 'maxlength', 255);
     $mform->setHelpButton('idnumber', array('userform/idnumber', get_string('idnumber'), 'block_curr_admin'));
     $username_group = array();
     if (empty($disabled)) {
         $mform->addRule('idnumber', null, 'required', null, 'client');
         $username_group[] =& $mform->createElement('text', 'username', get_string('username'));
         $username_group[] =& $mform->createElement('checkbox', 'id_same_user', null, get_string('id_same_as_user', 'block_curr_admin'));
         $mform->disabledIf('username_group', 'id_same_user', 'checked');
         $mform->addGroup($username_group, 'username_group', get_string('username'), ' ', false);
         $mform->addRule('username_group', $strrequired, 'required', null, 'client');
     } else {
         $mform->freeze('idnumber');
         $username_group[] =& $mform->createElement('static', 'username');
         $mform->addGroup($username_group, 'username_group', get_string('username'), ' ', false);
         $mform->freeze('username_group');
     }
     $mform->addGroupRule('username_group', array('username' => array(array(null, 'maxlength', 100))));
     $mform->addElement('passwordunmask', 'newpassword', get_string('newpassword'));
     $mform->setType('newpassword', PARAM_TEXT);
     $mform->addRule('newpassword', null, 'maxlength', 25);
     $mform->addElement('text', 'firstname', get_string('userfirstname', 'block_curr_admin'));
     $mform->setType('firstname', PARAM_TEXT);
     $mform->addRule('firstname', $strrequired, 'required', null, 'client');
     $mform->addRule('firstname', null, 'maxlength', 100);
     $mform->addElement('text', 'lastname', get_string('userlastname', 'block_curr_admin'));
     $mform->setType('lastname', PARAM_TEXT);
     $mform->addRule('lastname', $strrequired, 'required', null, 'client');
     $mform->addRule('lastname', null, 'maxlength', 100);
     $mform->addElement('text', 'mi', get_string('usermi', 'block_curr_admin'));
     $mform->setType('mi', PARAM_TEXT);
     $mform->addRule('mi', null, 'maxlength', 100);
     $mform->addElement('text', 'email', get_string('email', 'block_curr_admin'));
     $mform->setType('email', PARAM_TEXT);
     $mform->addRule('email', null, 'email', null, 'client');
     $mform->addRule('email', null, 'required', null, 'client');
     $mform->addRule('email', null, 'maxlength', 100);
     $mform->addElement('text', 'email2', get_string('email2', 'block_curr_admin'));
     $mform->setType('email2', PARAM_TEXT);
     $mform->addRule('email2', null, 'email', null, 'client');
     $mform->addRule('email2', null, 'maxlength', 100);
     $mform->addElement('text', 'address', get_string('useraddress', 'block_curr_admin'));
     $mform->setType('address', PARAM_TEXT);
     $mform->addRule('address', null, 'maxlength', 100);
     $mform->addElement('text', 'address2', get_string('useraddress2', 'block_curr_admin'));
     $mform->setType('address2', PARAM_TEXT);
     $mform->addRule('address2', null, 'maxlength', 100);
     $mform->addElement('text', 'city', get_string('usercity', 'block_curr_admin'));
     $mform->setType('city', PARAM_TEXT);
     $mform->addRule('city', null, 'maxlength', 100);
     $mform->addElement('text', 'state', get_string('userstate', 'block_curr_admin'));
     $mform->setType('state', PARAM_TEXT);
     $mform->addRule('state', null, 'maxlength', 100);
     $mform->addElement('text', 'postalcode', get_string('userpostalcode', 'block_curr_admin'));
     $mform->setType('postalcode', PARAM_TEXT);
     $mform->addRule('postalcode', null, 'maxlength', 32);
     $country = cm_get_list_of_countries();
     $default_country[''] = get_string('selectacountry');
     $country = array_merge($default_country, $country);
     $mform->addElement('select', 'country', get_string('country'), $country);
     $mform->addRule('country', $strrequired, 'required', null, 'client');
     $mform->addElement('text', 'phone', get_string('phone'));
     $mform->setType('phone', PARAM_TEXT);
     $mform->addRule('phone', null, 'maxlength', 100);
     $mform->addElement('text', 'phone2', get_string('phone2', 'block_curr_admin'));
     $mform->setType('phone2', PARAM_TEXT);
     $mform->addRule('phone2', null, 'maxlength', 100);
     $mform->addElement('text', 'fax', get_string('fax', 'block_curr_admin'));
     $mform->setType('fax', PARAM_TEXT);
     $mform->addRule('fax', null, 'maxlength', 100);
     $bdaygroup = array();
     $days[''] = get_string('selectdays', 'block_curr_admin');
     for ($i = 1; $i <= 31; $i++) {
         $days[$i] = $i;
     }
     $months[''] = get_string('selectmonths', 'block_curr_admin');
     for ($i = 1; $i <= 12; $i++) {
         $months[$i] = userdate(gmmktime(12, 0, 0, $i, 15, 2000), "%B");
     }
     $years[''] = get_string('selectyears', 'block_curr_admin');
     for ($i = 1900; $i <= 2020; $i++) {
         $years[$i] = $i;
     }
     $bdaygroup[] =& $mform->createElement('select', 'birthday', get_string('day', 'block_curr_admin'), $days, '', true);
     $bdaygroup[] =& $mform->createElement('select', 'birthmonth', get_string('month', 'block_curr_admin'), $months, '', true);
     $bdaygroup[] =& $mform->createElement('select', 'birthyear', get_string('year', 'block_curr_admin'), $years, '', true);
     $mform->addGroup($bdaygroup, 'birthdate', get_string('userbirthdate', 'block_curr_admin'), ' ', false);
     //        $mform->addElement('date_selector', 'birthdate', get_string('userbirthdate', 'block_curr_admin')); //TODO: the bdaygroup stuff with this but need to update the pages as well
     $radioarray = array();
     $radioarray[] =& $mform->createElement('radio', 'gender', '', get_string('male', 'block_curr_admin'), 'M');
     $radioarray[] =& $mform->createElement('radio', 'gender', '', get_string('female', 'block_curr_admin'), 'F');
     $mform->addGroup($radioarray, 'gender', get_string('usergender', 'block_curr_admin'), ' ', false);
     $language = cm_get_list_of_languages();
     $mform->addElement('select', 'language', get_string('userlanguage', 'block_curr_admin'), $language);
     $mform->setDefault('language', 'English');
     $mform->setHelpButton('language', array('userform/language', get_string('userlanguage', 'block_curr_admin'), 'block_curr_admin'));
     $mform->addElement('text', 'transfercredits', get_string('transfercredits', 'block_curr_admin'));
     $mform->setType('transfercredits', PARAM_INT);
     $mform->setHelpButton('transfercredits', array('userform/transfercredits', get_string('transfercredits', 'block_curr_admin'), 'block_curr_admin'));
     $mform->addElement('textarea', 'comments', get_string('usercomments', 'block_curr_admin'));
     $mform->setType('comments', PARAM_CLEAN);
     $mform->setHelpButton('comments', array('userform/comments', get_string('usercomments', 'block_curr_admin'), 'block_curr_admin'));
     $mform->addElement('textarea', 'notes', get_string('notes', 'block_curr_admin'));
     $mform->setType('notes', PARAM_CLEAN);
     $mform->setHelpButton('notes', array('userform/notes', get_string('notes', 'block_curr_admin'), 'block_curr_admin'));
     $mform->addElement('advcheckbox', 'inactive', get_string('inactive', 'block_curr_admin'));
     $mform->setType('inactive', PARAM_TEXT);
     $mform->setHelpButton('inactive', array('userform/inactive', get_string('inactive', 'block_curr_admin'), 'block_curr_admin'));
     $fields = field::get_for_context_level('user');
     $fields = $fields ? $fields : array();
     $lastcat = null;
     $context = isset($this->_customdata['obj']) && isset($this->_customdata['obj']->id) ? get_context_instance(context_level_base::get_custom_context_level('user', 'block_curr_admin'), $this->_customdata['obj']->id) : get_context_instance(CONTEXT_SYSTEM);
     require_once CURMAN_DIRLOCATION . '/plugins/manual/custom_fields.php';
     foreach ($fields as $rec) {
         $field = new field($rec);
         if (!isset($field->owners['manual'])) {
             continue;
         }
         if ($lastcat != $rec->categoryid) {
             $lastcat = $rec->categoryid;
             $mform->addElement('header', "category_{$lastcat}", htmlspecialchars($rec->categoryname));
         }
         manual_field_add_form_element($this, $context, $field, !$field->multivalued);
         // ELIS-4000: Multi-valued fields require custom validation in form
     }
     if ($this->_customdata['obj']) {
         $this->set_data($this->_customdata['obj']);
     }
     $this->add_action_buttons();
 }
Exemplo n.º 5
0
function cm_get_country($code)
{
    $countries = cm_get_list_of_countries();
    if (!isset($countries[$code])) {
        return get_string('unknown', 'block_curr_admin');
    } else {
        return $countries[$code];
    }
}
Exemplo n.º 6
0
 /**
  * Make Custom Filter Options
  *
  * This function handles filters that require custom values (languages, countries, etc).
  *
  * @param string $group  The index of the group to which the sub filter belongs to.
  * @param string $name   The name of the sub filter to process.
  * @param array  $help   An array representing the help icon for the filter
  * @return array The customized options for the selected sub-filter
  */
 function make_filter_options_custom($options, $group, $name)
 {
     switch ($name) {
         case 'fullname':
             //combine the firstname and lastname into a fullname field
             $firstname = $this->tables[$group]['crlm_user'] . '.firstname';
             $lastname = $this->tables[$group]['crlm_user'] . '.lastname';
             $options['dbfield'] = sql_fullname($firstname, $lastname);
             $options['talias'] = '';
             //todo: find a better way to do this
             $this->fieldtofiltermap[$group][$options['dbfield']] = generalized_filter_elisuserprofile::filtertypetext;
             break;
         case 'country':
             //populate dropdown entries for countries
             $countries = cm_get_list_of_countries();
             $options['choices'] = $countries;
             break;
         case 'language':
             //populate dropdown entries for languages
             $languages = cm_get_list_of_languages();
             $options['choices'] = $languages;
             break;
         case 'inactive':
             //populate dropdown entries for inactive flag filtering options
             $options['choices'] = array('0' => get_string('no'), 1 => get_string('yes'));
             $options['numeric'] = 1;
             break;
     }
     $pos = strpos($name, 'customfield-');
     if ($pos !== false) {
         $options['contextlevel'] = context_level_base::get_custom_context_level('user', 'block_curr_admin');
     }
     return $options;
 }
 /**
  * Creates rows for each item in $items.
  * @param $items array of records
  * @param $columns associative array of column ids => column heading text.  column ids correspond to record properties.
  * @param $table the table object to add the items to
  */
 function add_table_items($items, $columns, $table = null)
 {
     $countries = cm_get_list_of_countries();
     $table->width = "95%";
     foreach ($items as $item) {
         // TODO: (short term) push this logic to the page class, by using a get_cell_value($item, $columnname) function that is called for
         // each cell in the table.
         // TODO: (long term) push this logic to the model, either by using accessors or by using field types
         $newarr = array();
         foreach ($columns as $column => $cdesc) {
             // From cmclasspage
             if ($column == 'idnumber') {
                 $newarr[] = '<a href="index.php?s=rep&amp;section=rept&amp;type=classroster&amp;' . 'class=' . $item->id . '">' . $item->idnumber . '</a>';
             } else {
                 if ($column == 'envname') {
                     $newarr[] = '<div align="center"><span title="' . $item->envdescription . '">' . $item->envname . '</span></div>';
                 } else {
                     if ($column == 'startdate' || $column == 'enddate') {
                         if (empty($item->{$column})) {
                             $newarr[] = '-';
                         } else {
                             $newarr[] = cm_timestamp_to_date($item->{$column});
                         }
                     } else {
                         if ($column == 'starttime') {
                             if ($item->starttimehour == '0' && $item->starttimeminute == '0') {
                                 $newarr[] = 'n/a';
                             } else {
                                 $newarr[] = $item->starttimehour . ':' . sprintf("%02d", $item->starttimeminute);
                             }
                         } else {
                             if ($column == 'endtime') {
                                 if ($item->endtimehour == '0' && $item->endtimeminute == '0') {
                                     $newarr[] = 'n/a';
                                 } else {
                                     $newarr[] = $item->endtimehour . ':' . sprintf("%02d", $item->endtimeminute);
                                 }
                                 // From usermanagementpage
                             } else {
                                 if ($column == 'location') {
                                     $newarr[] = '<a href="index.php?s=rep&amp;section=rept&amp;type=' . 'recloc&amp;loc=' . $item->location . '">' . $item->location . '</a>';
                                 } else {
                                     if ($column == 'currentclass') {
                                         $newarr[] = '<a href="index.php?s=rep&amp;section=rept&amp;type=' . 'classroster&amp;class=' . $item->currentclassid . '">' . $item->currentclass . '</a>';
                                     } else {
                                         if ($column == 'lastclass') {
                                             $newarr[] = '<a href="index.php?s=rep&amp;section=rept&amp;type=' . 'classroster&amp;class=' . $item->lastclassid . '">' . $item->lastclass . '</a>';
                                         } else {
                                             if ($column == 'country') {
                                                 $newarr[] = isset($countries[$item->country]) ? $countries[$item->country] : '';
                                             } else {
                                                 if ($column == 'timecreated') {
                                                     if (!empty($item->origenroldate)) {
                                                         $dateparts = explode('/', $item->origenroldate);
                                                         $bt = mktime(0, 0, 0, $dateparts[1], $dateparts[2], $dateparts[0]);
                                                         $newarr[] = userdate($bt);
                                                     } else {
                                                         if (!empty($item->timecreated)) {
                                                             $newarr[] = userdate($item->timecreated);
                                                         } else {
                                                             $newarr[] = '-';
                                                         }
                                                     }
                                                 } else {
                                                     $newarr[] = $item->{$column};
                                                 }
                                             }
                                         }
                                     }
                                 }
                             }
                         }
                     }
                 }
             }
             // Add link to specified columns
             if (in_array($column, $this->view_columns)) {
                 $target = $this->get_new_page(array('action' => 'view', 'id' => $item->id));
                 $newarr[count($newarr) - 1] = '<a href="' . $target->get_url() . '">' . $newarr[count($newarr) - 1] . '</a>';
             }
         }
         $newarr[] = $this->get_buttons(array('id' => $item->id));
         $table->data[] = $newarr;
     }
     return $table;
 }