function get_all_user_groups() { foreach(get_active_usertypes() as $usertype) { //check if the usertype already added $where=array ( 'usertype'=>$usertype['id'], 'trash'=>'n' ); //if does not exist add it if(!$this->get_where($where)) { //do insert $dbdata=array ( 'usertype'=>$usertype['id'], ); $this->create($dbdata); } } }
<input required="" type="text" class="form-control fname" value="<?= $fname == 'default' ? '' : ucfirst($fname) ?>" placeholder="First name"> </div> <div class="form-group"> <input required="" type="text" class="form-control lname" value="<?= $lname == 'default' ? '' : ucfirst($lname) ?>" placeholder="Last name"> </div> <div class="form-group"> <select required="" id="usertype" style="width:100%" class="populate usertype"> <optgroup label="Available User types"> <option selected="" class="text-info" value="<?=$usr_type?>"><?=ucwords(get_usertype($usr_type,'title'))?></option> <?php $usertypes=get_active_usertypes(); foreach($usertypes as $type) { ?> <option value="<?=$type['id']?>"><?=ucwords($type['usertype'])?></option> <?php } ?> </optgroup> </select> </div>
<li><a href="#" onClick="$('#customers2').tableExport({type:'pdf',escape:'false'});"><img src='<?= base_url() ?>assets_backend/img/icons/pdf.png' width="24"/> PDF</a></li> </ul> </div> <div id="customers2" class="panel-body"> <table class="table datatable"> <thead> <tr> <th>Group title</th> <th>Actions</th> </tr> </thead> <tbody> <?php foreach (get_active_usertypes() as $type) { ?> <tr> <td class="hidden-xs"><?= ucwords($type['usertype']) ?></td> <td> <?php //array of uneditable/deletable usertypes $unchangeable = array('1', '4'); if (!in_array($type['id'], $unchangeable)) { //if user can edit if (check_my_access('edit_user_group')) { ?> <a class="action_btn"