Exemplo n.º 1
0
 function init()
 {
     $dbq = $this->admin_page->get_required_ar_dbq();
     $this->values = $dbq->run();
     $this->borrowed_by = get_sites_that_are_borrowing_entity($this->admin_page->id);
     /* if( empty( $this->values ) && empty($this->borrowed_by ) )
     			{
     				$link = unhtmlentities( $this->admin_page->make_link( array( 'cur_module' => 'Delete' ) ) );
     				header( 'Location: ' . $link );
     				die();
     			} */
     $this->admin_page->title = 'Why can\'t I delete this item?';
 }
Exemplo n.º 2
0
 function is_deletable($id = 0)
 {
     $id = (int) $id;
     if (empty($id)) {
         $id = $this->id;
     }
     if (empty($id)) {
         return false;
     }
     //get all one-to-many required relationships that the current item is a part of
     $entity = new entity($id);
     $user = new entity($this->user_id);
     $subject_of_required_rels = array();
     $dbq = $this->get_required_ar_dbq($id);
     if (!empty($dbq)) {
         $subject_of_required_rels = $dbq->run();
     }
     $sites = get_sites_that_are_borrowing_entity($id);
     if ($subject_of_required_rels || !empty($sites) || !$entity->user_can_edit_field('state', $user)) {
         return false;
     } else {
         return true;
     }
 }