Skip to content
Snippets Groups Projects
class_manage_entities_Abstract.php 72.8 KiB
Newer Older
  • Learn to ignore specific revisions
  •             $_SESSION['error'].= _TYPE_MISSING.'<br/>';
            }
            $_SESSION['service_tag'] = 'entity_check';
            $core->execute_modules_services($_SESSION['modules_services'], 'entity_check', "include");
            $core->execute_app_services($_SESSION['app_services'], 'entity_check', 'include');
            $_SESSION['service_tag'] = '';
            $_SESSION['m_admin']['entity']['parent'] = '';
            if(isset($_REQUEST['parententity']) && !empty($_REQUEST['parententity']))
            {
                $_SESSION['m_admin']['entity']['parent'] = $_REQUEST['parententity'];
            }
            $_SESSION['m_admin']['init'] = false;
    
            $_SESSION['m_admin']['entity']['order'] = $_REQUEST['order'];
            $_SESSION['m_admin']['entity']['order_field'] = $_REQUEST['order_field'];
            $_SESSION['m_admin']['entity']['what'] = $_REQUEST['what'];
            $_SESSION['m_admin']['entity']['start'] = $_REQUEST['start'];
        }
    
    
        /**
        * Add ou modify entity in the database
        *
        * @param string $mode up or add
        */
        public function addupentity($mode)
        {
            //require_once('core'.DIRECTORY_SEPARATOR.'class'.DIRECTORY_SEPARATOR.'class_core_tools.php');
            $core = new core_tools();
            // add ou modify entity in the database
            $this->entityinfo($mode);
            $order = $_SESSION['m_admin']['entity']['order'];
            $order_field = $_SESSION['m_admin']['entity']['order_field'];
            $what = $_SESSION['m_admin']['entity']['what'];
            $start = $_SESSION['m_admin']['entity']['start'];
            if(!empty($_SESSION['error']))
            {
                if($mode == 'up')
                {
                    if(!empty($_SESSION['m_admin']['entity']['entityId'] ))
                    {
                        header('location: '.$_SESSION['config']['businessappurl'].'index.php?page=entity_up&id='.$_SESSION['m_admin']['entity']['entityId'] .'&module=entities');
                        exit();
                    }
                    else
                    {
                        header('location: '.$_SESSION['config']['businessappurl'].'index.php?page=manage_entities&module=entities&order='.$order.'&order_field='.$order_field.'&start='.$start.'&what='.$what);
                        exit();
                    }
                }
                elseif($mode == 'add')
                {
                    header('location: '.$_SESSION['config']['businessappurl'].'index.php?page=entity_add&module=entities');
                    exit();
                }
            }
            else
            {
                $db = new Database();
                if($mode == 'add')
                {
                    $stmt= $db->query('select entity_id from '.ENT_ENTITIES.' where entity_id = ?',array(trim($_SESSION['m_admin']['entity']['entityId'])));
                    if($stmt->rowCount() > 0)
                    {
                        $_SESSION['error'] = $_SESSION['m_admin']['entity']['entityId'] .' '._ALREADY_EXISTS.'<br />';
                        header('location: '.$_SESSION['config']['businessappurl'].'index.php?page=entity_add&module=entities');
                        exit();
                    }
                    else
                    {
                        if ($_SESSION['m_admin']['entity']['parent'] == '') {
                            $entityPath = '/' . $_SESSION['m_admin']['entity']['entityId'];
                        } else {
                            require_once 'modules/entities/class/EntityControler.php';
                            $entityCtrl = new EntityControler();
                            $entityTree = $entityCtrl->getEntityParentTreeOf($_SESSION['m_admin']['entity']['parent']);
                            
                            if (count($entityTree) > 0) {
                                for ($cptTree = 0;$cptTree<count($entityTree);$cptTree++) {
                                    $stmt = $db->query("select entity_id from entities where entity_id = ?",array($entityTree[$cptTree]->__get('parent_entity_id')));
                                    $resShortLabel = $stmt->fetchObject();
                                    if ($resShortLabel->entity_id <> '') {
                                        $entityIdForTree = functions::show_string($resShortLabel->entity_id);
                                    } else {
                                        $entityIdForTree = $entityTree[$cptTree]->__get('parent_entity_id');
                                    }
                                    $entityPath .=  $entityIdForTree . '/';
                                }
                            }
                            $stmt = $db->query("select entity_id from entities where entity_id = ?",array($_SESSION['m_admin']['entity']['parent']));
                            $resShortLabel = $stmt->fetchObject();
                            if ($resShortLabel->entity_id <> '') {
                                $entityIdForTree = functions::show_string($resShortLabel->entity_id);
                            } else {
                                $entityIdForTree = $_SESSION['m_admin']['entity']['parent'];
                            }
                            $entityPath .= $entityIdForTree . '/' . $_SESSION['m_admin']['entity']['entityId'];
                        }
                        
    
                        $stmt = $db->query('INSERT INTO '.ENT_ENTITIES." (entity_id, entity_label, short_label, adrs_1, adrs_2, adrs_3, zipcode, city, country, email, business_id, parent_entity_id, entity_type, entity_path, archival_agency, archival_agreement) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)",array($_SESSION['m_admin']['entity']['entityId'],$_SESSION['m_admin']['entity']['label'],$_SESSION['m_admin']['entity']['short_label'],$_SESSION['m_admin']['entity']['adrs1'],$_SESSION['m_admin']['entity']['adrs2'],$_SESSION['m_admin']['entity']['adrs3'],$_SESSION['m_admin']['entity']['zcode'],$_SESSION['m_admin']['entity']['city'],$_SESSION['m_admin']['entity']['country'],$_SESSION['m_admin']['entity']['email'],$_SESSION['m_admin']['entity']['business'],$_SESSION['m_admin']['entity']['parent'],$_SESSION['m_admin']['entity']['type'],$entityPath,$_SESSION['m_admin']['entity']['archival_agency'],$_SESSION['m_admin']['entity']['archival_agreement']));
    
                        $_SESSION['service_tag'] = 'entity_add_db';
                        $core->execute_modules_services($_SESSION['modules_services'], 'entity_add_db', "include");
                        $core->execute_app_services($_SESSION['app_services'], 'entity_add_db', 'include');
                        $_SESSION['service_tag'] = '';
    
                        if($_SESSION['history']['entityadd'] == "true")
                        {
                            require_once("core".DIRECTORY_SEPARATOR."class".DIRECTORY_SEPARATOR."class_history.php");
                            $hist = new history();
                            $hist->add(ENT_ENTITIES, $_SESSION['m_admin']['entity']['entityId'] ,"ADD",'entityadd',_ADD_ENTITY." : ".$_SESSION['m_admin']['entity']['entityId'] , $_SESSION['config']['databasetype'], 'entities');
                        }
                        $this->clearentityinfos();
                        $_SESSION['info'] = _ENTITY_ADDITION;
                        unset($_SESSION['m_admin']);
                        header("location: ".$_SESSION['config']['businessappurl']."index.php?page=manage_entities&module=entities&order=".$order."&order_field=".$order_field."&start=".$start."&what=".$what);
                        exit();
                    }
                }
                elseif($mode == 'up')
                {
                    if ($_SESSION['m_admin']['entity']['parent'] == '') {
                        $entityPath = '/' . $_SESSION['m_admin']['entity']['entityId'];
                    } else {
                        require_once 'modules/entities/class/EntityControler.php';
                        $entityCtrl = new EntityControler();
                        $entityTree = $entityCtrl->getEntityParentTreeOf($_SESSION['m_admin']['entity']['parent']);
                        
                        if (count($entityTree) > 0) {
                            for ($cptTree = 0;$cptTree<count($entityTree);$cptTree++) {
                                $stmt = $db->query("select entity_id from entities where entity_id = ?",array($entityTree[$cptTree]->__get('parent_entity_id')));
                                $resShortLabel = $stmt->fetchObject();
                                if ($resShortLabel->entity_id <> '') {
                                    $entityIdForTree = functions::show_string($resShortLabel->entity_id);
                                } else {
                                    $entityIdForTree = $entityTree[$cptTree]->__get('parent_entity_id');
                                }
                                $entityPath .=  $entityIdForTree . '/';
                            }
                        }
                        $stmt = $db->query("select entity_id from entities where entity_id = ?",array($_SESSION['m_admin']['entity']['parent']));
                        $resShortLabel = $stmt->fetchObject();
                        if ($resShortLabel->entity_id <> '') {
                            $entityIdForTree = functions::show_string($resShortLabel->entity_id);
                        } else {
                            $entityIdForTree = $_SESSION['m_admin']['entity']['parent'];
                        }
                        $entityPath .= $entityIdForTree . '/' . $_SESSION['m_admin']['entity']['entityId'];
                    }
                        
    
                    $stmt = $db->query('UPDATE '.ENT_ENTITIES." set entity_label = ? , short_label = ? , adrs_1 = ?, adrs_2 = ?, adrs_3 = ?, zipcode = ?, city = ?, country = ?, email = ?, business_id = ?, parent_entity_id = ?, entity_type = ?, entity_path = ?, archival_agency = ?, archival_agreement = ? where entity_id = ?",array($_SESSION['m_admin']['entity']['label'], $_SESSION['m_admin']['entity']['short_label'], $_SESSION['m_admin']['entity']['adrs1'], $_SESSION['m_admin']['entity']['adrs2'],$_SESSION['m_admin']['entity']['adrs3'], $_SESSION['m_admin']['entity']['zcode'], $_SESSION['m_admin']['entity']['city'], $_SESSION['m_admin']['entity']['country'], $_SESSION['m_admin']['entity']['email'], $_SESSION['m_admin']['entity']['business'], $_SESSION['m_admin']['entity']['parent'], $_SESSION['m_admin']['entity']['type'], $entityPath, $_SESSION['m_admin']['entity']['archival_agency'], $_SESSION['m_admin']['entity']['archival_agreement'],$_SESSION['m_admin']['entity']['entityId']));
    
                    $_SESSION['service_tag'] = 'entity_up_db';
                    $core->execute_modules_services($_SESSION['modules_services'], 'entity_up_db', "include");
                    $core->execute_app_services($_SESSION['app_services'], 'entity_up_db', 'include');
                    $_SESSION['service_tag'] = '';
                    if($_SESSION['history']['entityup'] == "true")
                    {
                        require_once('core'.DIRECTORY_SEPARATOR.'class'.DIRECTORY_SEPARATOR.'class_history.php');
                        $hist = new history();
                        $hist->add(ENT_ENTITIES, $_SESSION['m_admin']['entity']['entityId'] ,'UP','entityup',_ENTITY_UPDATED.' : '.$_SESSION['m_admin']['entity']['entityId'] , $_SESSION['config']['databasetype'], 'folder');
                    }
                    $this->clearentityinfos();
                    $_SESSION['info'] = _ENTITY_MODIFICATION;
                    unset($_SESSION['m_admin']);
                    header('location: '.$_SESSION['config']['businessappurl'].'index.php?page=manage_entities&module=entities&order='.$order."&order_field=".$order_field."&start=".$start."&what=".$what);
                    exit();
                }
            }
        }
    
    
        /**
        * Clean the $_SESSION['m_admin']['entity'] array
        */
        protected function clearentityinfos()
        {
            // clear the users add or modification vars
            unset($_SESSION['m_admin']);
        }
    
        /**
        * Get array of all entity_type that a user has acces
        *
        * @param string $level the entity_type's level of the primary entity of a user
        */
        public function load_entities_types_for_user($level="all")
        {
            $entypes = array();
            $type = array();
            foreach($_SESSION['entities_types'] as $type)
            {
                if ($level == 'root')
                {
                    if($type['level'] == 'node')
                    {
                        $entypes[] = $type;
                    }
                }
                elseif($level =="node")
                {
                    if($type['level'] == 'none')
                    {
                        $entypes[] = $type;
                    }
                }
                elseif($level =="all")
                {
                    $entypes[] = $type;
                }
            }
            return $entypes;
        }
    
        /**
        * Get the entity_type_level of an entity
        *
        * @param string $entity_id identifier of the entity
        */
        public function get_entity_type_level($entity_id)
        {
            $type_level = "";
            $found_type_level = false;
            
            $db = new Database();
            $stmt = $db->query('select entity_id, entity_label, short_label, entity_type from '.ENT_ENTITIES." where entity_id  = ?",array(trim($entity_id)));
            //$this->show();
            $line = $stmt->fetchObject();
            $entity_type = $line->entity_type;
            if(file_exists($_SESSION['config']['corepath'].'custom'.DIRECTORY_SEPARATOR.$_SESSION['custom_override_id'].DIRECTORY_SEPARATOR."modules".DIRECTORY_SEPARATOR."entities".DIRECTORY_SEPARATOR."xml".DIRECTORY_SEPARATOR."typentity.xml"))
            {
                $path = $_SESSION['config']['corepath'].'custom'.DIRECTORY_SEPARATOR.$_SESSION['custom_override_id'].DIRECTORY_SEPARATOR."modules".DIRECTORY_SEPARATOR."entities".DIRECTORY_SEPARATOR."xml".DIRECTORY_SEPARATOR."typentity.xml";
            }
            else
            {
                $path = "modules".DIRECTORY_SEPARATOR."entities".DIRECTORY_SEPARATOR."xml".DIRECTORY_SEPARATOR."typentity.xml";
            }
    
            $xmltypeentity = simplexml_load_file($path);
            //echo "<br>";
            foreach($xmltypeentity->TYPE as $ENTITYTYPE)
            {
                if($ENTITYTYPE->id == $entity_type)
                {
                    $type_level =  (string) $ENTITYTYPE->typelevel;
                    $found_type_level = true;
                    break;
                }
            }
            if ($found_type_level)
            {
                return $type_level;
            }
            else
            {
                return $found_type_level;
            }
        }
    
        /**
        * Return the parent of an entity
        *
        * @param string $entity_id identifier of the entity
        */
        public function getParentEntityId($entity_id)
        {
            if(!empty($entity_id))
            {
                $db = new Database();
                $stmt = $db->query("select parent_entity_id from ".ENT_ENTITIES." where entity_id = ?",array(trim($entity_id)));
                $res = $stmt->fetchObject();
                return $res->parent_entity_id;
            }
            else
            {
                return '';
            }
        }
    
        public function getTabSisterEntityId($entity_id)
        {
            $sisters = array();
            if(!empty($entity_id))
            {
                $parent = $this->getParentEntityId($entity_id);
                $db = new Database();
                if(!empty($parent))
                {
                    $stmt = $db->query('select entity_id from '.ENT_ENTITIES." where parent_entity_id = ? and entity_id <> ?",array(trim($parent),trim($entity_id)));
                    while($res = $stmt->fetchObject())
                    {
                        array_push($sisters, "'".$res->entity_id."'");
                    }
                }
            }
            return $sisters;
        }
    
        public function is_user_in_entity($user_id, $entity_id)
        {
            if($_SESSION['user']['UserId'] == $user_id)
            {
                for($i=0; $i<count($_SESSION['user']['entities']);$i++)
                {
                    if($_SESSION['user']['entities'][$i]['ENTITY_ID'] == $entity_id)
                    {
                        return true;
                    }
                }
                return false;
            }
            else
            {
                $db = new Database();
                $stmt = $db->query("select entity_id from ".ENT_USERS_ENTITIES." where user_id = ? and entity_id = ?",array(trim($user_id),trim($entity_id)));
                if($stmt->rowCount() == 1)
                {
                    return true ;
                }
                else
                {
                    return false;
                }
            }
        }
    
        public function get_primary_entity($user_id)
        {
            if(empty($user_id))
            {
                return false;
            }
            $db = new Database();
            $stmt = $db->query("select ue.entity_id, ue.user_role, e.entity_label, e.short_label from ".ENT_ENTITIES." e, ".ENT_USERS_ENTITIES." ue where ue.user_id = ? and ue.entity_id = e.entity_id and ue.primary_entity = 'Y'",array(trim($user_id)));
            $res = $stmt->fetchObject();
            return array(
            	'ID' => $res->entity_id,
            	'LABEL' => $res->entity_label,
            	'SHORT_LABEL' => $res->short_label,
            	'ROLE' => $res->user_role
            );
        }
    
         public function increaseListinstanceViewed($docId) {
            if(isset($_SESSION['collection_id_choice']) && !empty($_SESSION['collection_id_choice'])) {
                $collId = $_SESSION['collection_id_choice'];
            } else {
                $collId = $_SESSION['collections'][0]['id'];
            }
            if($docId <> "" && $collId <> "") {
                $entities = '';
                for($cptEnt=0;$cptEnt<count($_SESSION['user']['entities']);$cptEnt++) {
    				$entities .= "'" . $_SESSION['user']['entities'][$cptEnt]['ENTITY_ID'] . "', ";
    			}
    			$entities = preg_replace('/, $/', '', $entities);
    			if($entities == '' && $_SESSION['user']['UserId']== 'superadmin') {
    				$entities = $this->empty_list();
    			}
                $db = new Database();
                $stmt = $db->query("select res_id, viewed from ".$_SESSION['tablename']['ent_listinstance']." where coll_id = ? and res_id = ? and item_type = 'user_id' and item_id = ?",array($collId,$docId,$_SESSION['user']['UserId']));
                //$this->show();
                $res = $stmt->fetchObject();
                $cptViewed = 0;
                if(isset($res->res_id) && $res->res_id <> "") {
                    if($res->viewed <> "" && $res->viewed <> 0) {
                        $cptViewed = $res->viewed + 1;
                    } else {
                        $cptViewed = 1;
                    }
                    $stmt = $db->query("update ".$_SESSION['tablename']['ent_listinstance']." set viewed = ".$cptViewed." where coll_id = ? and res_id = ? and item_type = 'user_id' and item_id = ?",array($collId,$docId,$_SESSION['user']['UserId']));
                    //$this->show();
                }
                $db = new Database();
                if(isset($entities) && $entities <> "") {
                    $stmt = $db->query("select res_id, viewed, item_id from ".$_SESSION['tablename']['ent_listinstance']." where coll_id = ? and res_id = ? and item_type = 'entity_id' and ".$_SESSION['tablename']['ent_listinstance'].".item_id in (?)",array($collId,$docId,$entities));
                    //$this->show();
                    while($res = $stmt->fetchObject()) {
                        $cptViewed = 0;
                        if($res->res_id <> "") {
                            if($res->viewed <> "" && $res->viewed <> 0) {
                                $cptViewed = $res->viewed + 1;
                            } else {
                                $cptViewed = 1;
                            }
                            $stmt = $db->query("update ".$_SESSION['tablename']['ent_listinstance']." set viewed = ? where coll_id = ? and res_id = ? and item_type = 'entity_id' and ".$_SESSION['tablename']['ent_listinstance'].".item_id = ?",array($cptViewed,$collId,$docId,$res->item_id));
                            //$db->show();
                        }
                    }
                }
            }
        }
    
        public function formDeleteEntity($s_id, $label, $entities, $admin)
        {
            echo '<h1><i class="fa fa-sitemap fa-2x"></i> '._ENTITY_DELETION.'</h1>';
    
            $element_found = false;
            $haveChild = false;
            $tables = array();
            $nb_docs = 0;
            $nb_users = 0;
    
            if($admin->is_module_loaded('templates'))
            {
                $nb_templates = 0;
            }
    
            if($admin->is_module_loaded('basket'))
    
            {
                $nb_listmodels = 0;
                $nb_listinstances = 0;
                $nb_redirect_baskets = 0;
            }
            if(!empty($s_id))
            {
                if($this->havechild($s_id))
                {
                    $element_found = true;
                    $haveChild = true;
                }
    
                for($i=0; $i<count($_SESSION['collections']); $i++)
                {
                    // Skip this test if view doesn't have a column named res_id or destination
    
                    //if(!$this->test_column($_SESSION['collections'][$i]['view'], 'res_id')) continue;
                    //if(!$this->test_column($_SESSION['collections'][$i]['view'], 'destination')) continue;
    
                    
                    $db = new Database();
    
                    
                    $stmt = $db->query("select res_id from ".$_SESSION['collections'][$i]['view']." where destination = ?",array($s_id));
                    
    
                    //$this->show();
                    if($stmt->rowCount() > 0)
                    {
                        $element_found = true;
                        $nb_docs = $nb_docs + $stmt->rowCount();
                        array_push($tables, $_SESSION['collections'][$i]['table']);
                    }
                }
                $stmt = $db->query("select user_id from ".ENT_USERS_ENTITIES." where entity_id = ?",array($s_id));
                if($stmt->rowCount() > 0)
                {
                    $element_found = true;
                    $nb_users = $stmt->rowCount();
                }
    
                if($admin->is_module_loaded('templates'))
                {
                    $stmt = $db->query("select template_id from ".$_SESSION['tablename']['temp_templates_association']." where value_field = ? and what = 'destination'",array($s_id));
                    if($stmt->rowCount() > 0)
                    {
                        $element_found = true;
                        $nb_templates = $stmt->rowCount();
                    }
                }
    
                if($admin->is_module_loaded('basket'))
    
                {
                    $stmt = $db->query("select system_id from ".$_SESSION['tablename']['ent_groupbasket_redirect']." where entity_id = ?",array($s_id));
                    if($stmt->rowCount() > 0)
                    {
                        $element_found = true;
                        $nb_redirect_baskets = $stmt->rowCount();
                    }
                    $stmt = $db->query("select res_id from ".$_SESSION['tablename']['ent_listinstance']." where item_id = ? and item_type = 'entity_id'",array($s_id));
                    if($stmt->rowCount() > 0)
                    {
                        $element_found = true;
                        $nb_listinstances = $stmt->rowCount();
                    }
                    $stmt = $db->query("select object_id from ".$_SESSION['tablename']['ent_listmodels']." where object_id = ?",array($s_id));
                    if($stmt->rowCount() > 0)
                    {
                        $nb_listmodels = $stmt->rowCount();
                    }
                }
            }
            if($element_found)
            {
                echo "<div class='error' id='main_error'>".$_SESSION['error']."</div>";
                $_SESSION['error'] = "";
                ?>
                <br>
                <div id="main_error">
                    <b><?php
                    echo _WARNING_MESSAGE_DEL_ENTITY;
                    ?></b>
                </div>
                <br>
                <form name="entity_del" id="entity_del" method="post" class="forms">
                    <input type="hidden" value="<?php functions::xecho($s_id);?>" name="id">
                    <h2 class="tit"><?php echo _ENTITY_DELETION." : <i>".$label."</i>";?></h2>
                    <?php
                    if($element_found)
                    {
                        if($this->havechild($s_id))
                        {
                            echo "<br> - "._ENTITY_HAVE_CHILD;
                        }
                        echo "<br> - ".$nb_docs." "._DOC_IN_THE_DEPARTMENT;
                        echo "<br> - ".$nb_users." "._USERS_LINKED_TO;
    
    
                        if($admin->is_module_loaded('basket'))
    
                        {
                            echo "<br> - ".$nb_redirect_baskets." "._BASKET_REDIRECTIONS_OCCURS_LINKED_TO;
                            echo "<br> - ".$nb_listinstances." "._LISTISTANCES_OCCURS_LINKED_TO;
                            echo "<br> - ".$nb_listmodels." "._LISTMODELS_OCCURS_LINKED_TO;
                        }
                        if($admin->is_module_loaded('templates'))
                        {
                            echo "<br> - ".$nb_templates." "._TEMPLATES_LINKED_TO;
    
                        }
                        ?>
                        <br>
                        <br>
                        <input type="hidden" value="documents" name="documents">
                        <select name="doc_entity_id" id="doc_entity_id">
                            <option value=""><?php echo _CHOOSE_REPLACEMENT_DEPARTMENT;?></option>
                            <?php
                            for($i=0; $i < count($entities); $i++)
                            {
                                ?>
                                <option value="<?php functions::xecho($entities[$i]['ID']);?>"><?php echo $entities[$i]['LABEL'];?></option>
                                <?php
                            }
                            ?>
                        </select>
                        <br/>
                        <?php
                    }
                    ?>
                    <br/>
                    <p class="buttons">
                        <input type="submit" value="<?php echo _DEL_AND_REAFFECT;?>" name="valid" class="button" onclick="return(confirm('<?php echo _REALLY_DELETE;  if(isset($page_name) && $page_name == "users"){ functions::xecho($complete_name);} elseif(isset($admin_id)){ echo " ".$admin_id; }?> ?\n\r\n\r<?php echo _DEFINITIVE_ACTION;?>'));"/>
                        <input type="button" value="<?php echo _CANCEL;?>" onclick="window.location.href='<?php echo $_SESSION['config']['businessappurl'].'index.php?page=manage_entities&module=entities&order='.$_REQUEST['order']."&order_field=".$_REQUEST['order_field']."&start=".$_REQUEST['start']."&what=".$_REQUEST['what'];?>';"" class="button" />
                    </p>
                </form>
                <?php
            }
            else
            {
                $this->adminentity($s_id, 'del');
            }
        }
    }
    ?>