<?php
       global $vis_language;
       if($flag=='get_departments'){  ?>
           <select id="move_to" class="selectpicker" <? if(count($list)>9) echo 'data-live-search="true"';?> data-selector-label="<?= $vis_language['TXTMOVETO']; ?>">
            <option value="0" data-onclick="onclick='javascript:update_record_property(0,2);'" data-content="<span class='m-l-xs font-normal'><?= $vis_language['TXTUNASSIGNED'];?></span>"><?= $vis_language['TXTUNASSIGNED']; ?></option>
            <? for($i=0; $i<count($list); $i++){ 
                    if($domain_id=="" || ($domain_id!="" && $domain_id!=$list[$i]['domain_id'])){
                        $domain_id = $list[$i]['domain_id'];
                        if($i!=0) echo '</optgroup>';
                    }
                    $txt = $list[$i]['domain_name'] ." : ". $list[$i]['department_name']; ?>
            <option value="<?= $list[$i]['department_id']; ?>" data-onclick="onclick='javascript:update_record_property(<?= $list[$i]['department_id']; ?>,2);'" data-content="<span class='m-l-xs font-normal'><?= $txt; ?></span>"><?= $txt; ?></option>						
            <? } ?>						
        </select>
<?   }
      if($flag=='get_status'){ ?>
        <select id="" class="selectpicker" <? if(count($list)>10) echo 'data-live-search="true"';?> data-selector-label="<?= $vis_language['TXTSTATUS']; ?>">
            <? for($i=0; $i<count($list); $i++) {	?>						
            <option value="<?= $list[$i]['status_id']; ?>" data-onclick="onclick='javascript:update_record_property(<?= $list[$i]['status_id']; ?>,3);'" data-content="<span class='m-l-xs font-normal'><?= $list[$i]['status_name']; ?></span>"><?= $list[$i]['status_name']; ?></option>
            <?  } ?>						
        </select>
   <? }
      if($flag=='get_priorities'){ ?>
        <select id="" class="selectpicker" <? if(count($list)>10) echo 'data-live-search="true"';?> data-selector-label="<?= $vis_language['TXTPRIORITY']; ?>">
            <? for($i=0; $i<count($list); $i++) { ?>					
            <option value="<?= $list[$i]['priority_id']; ?>" data-onclick="onclick='javascript:update_record_property(<?= $list[$i]['priority_id']; ?>,4);'" data-content="<span class='m-l-xs font-normal'><?= $list[$i]['priority_name'];?></span>"><?= $list[$i]['priority_name']; ?></option>
           <? } ?>						
        </select>
   <? }
        if($flag=='get_impacts'){ ?>
        <select id="" class="selectpicker" <? if(count($list)>10) echo 'data-live-search="true"';?> data-selector-label="<?= $vis_language['TXTIMPACT']; ?>">
            <? for($i=0; $i<count($list); $i++) {	?>						
                <option value="<?= $list[$i]['impact_id']; ?>" data-onclick="onclick='javascript:update_record_property(<?= $list[$i]['impact_id']; ?>,5);'" data-content="<span class='m-l-xs font-normal'><?= $list[$i]['name'];?></span>"><?= $list[$i]['name']; ?></option>
            <? } ?>						
        </select>
   <? }
        if($flag=='get_risks'){ ?>
        <select id="" class="selectpicker" <? if(count($list)>10) echo 'data-live-search="true"';?> data-selector-label="<?= $vis_language['TXTRISK']; ?>">
            <? for($i=0; $i<count($list); $i++) {	?>						
                <option value="<?= $list[$i]['risk_id']; ?>" data-onclick="onclick='javascript:update_record_property(<?= $list[$i]['risk_id']; ?>,6);'" data-content='<span class="vh-stack pull-right"></span><?= $list[$i]['name'];?>'><?= $list[$i]['name']; ?></option>
            <? } ?>						
        </select>
   <? }
  if($flag=='owner'){ ?>
    <select name="owner"<? if(count($staff_list)>9) echo ' data-live-search="true"';?> data-selector-label="<label class='m-n font-bold'><? echo $vis_language['TXTASSIGNEDTO']; ?></label>" class="selectpicker">
        <option <? if($owner_details[0]['staff_id'] == 0) echo 'selected="selected"';?> value="0" data-content="<label class='checkbox-inline i-checks'<? if($owner_details[0]['staff_id'] != 0) echo " onclick='javascript:update_owner(0,1);'";?>><input type='checkbox' <? if($owner_details[0]['staff_id'] == 0) echo "checked='checked'";?>> <i></i><span class='m-l-xs font-normal'><? echo $vis_language['TXTUNASSIGNED'];?></span></label>"><? echo $vis_language['TXTUNASSIGNED'];?></option>
            <?  $owner1 = $vis_language['TXTUNASSIGNED'];
                $owner_cnt = (!empty($owner_details) && $owner_details != -1) ? count($owner_details) : 0;
                foreach ($staff_list as $staff) {
                    $selected = $checked = ""; $this_value = 1;
                    if ($owner_details != -1 ) {
                        foreach ($owner_details as $owner) {
                        if ($owner1 == $vis_language['TXTUNASSIGNED']) {
                            $owner1 = $owner['first_name'] . ' ' . $owner['last_name'];
                        }
                        if ($staff['staff_id'] == $owner['staff_id']) {
                            $selected = ' selected="selected"';
                            $checked = " checked='checked'";
                            $this_value = 0;
                            break;
                        } else {
                            $this_value = 1;
                        }
                    }
                    }
                ?>
        <option value="<?= $staff['staff_id'];?>"<? echo $selected ;?> data-content="<label class='checkbox-inline i-checks' onclick='javascript:update_owner(<?= $staff['staff_id'].','.$this_value;?>);'><input type='checkbox'<? echo $checked;?>> <i></i><span class='m-l-xs font-normal'><?= $staff['first_name'].' '.$staff['last_name'];?></span></label>"><?= $staff['first_name'].' '.$staff['last_name'];?></option>
        <? } ?>
    </select>    
<?  } ?>