Пример #1
0
 function get()
 {
     parent::get();
     if ($this->username == null) {
         throw new UserNotFound();
     }
 }
Пример #2
0
 public function __construct()
 {
     foreach ($this->objects as $map) {
         $this->{strtolower($map . 'mapper')} = DataMapper::get($map);
     }
     $this->template = new Templater();
 }
Пример #3
0
 /**
  * Overwrite of the get() function to add filters to the search.
  * Refer to DataMapper ORM for get() function details.
  *
  * @author	Woxxy
  * @param	integer|NULL $limit Limit the number of results.
  * @param	integer|NULL $offset Offset the results when limiting.
  * @return	DataMapper Returns self for method chaining.
  */
 public function get($limit = NULL, $offset = NULL)
 {
     // Get the CodeIgniter instance, since it isn't set in this file.
     $CI =& get_instance();
     // Check if the user is allowed to see protected chapters.
     if (!$CI->tank_auth->is_allowed()) {
         $this->where('hidden', 0);
     }
     $result = parent::get($limit, $offset);
     $this->get_licenses();
     $CI =& get_instance();
     if (!$CI->tank_auth->is_allowed() && !$CI->tank_auth->is_team()) {
         // Remove from the array the serie licensed in the user's nation
         foreach ($this->all as $key => $item) {
             if (in_array($CI->session->userdata('nation'), $this->licenses)) {
                 unset($this->all[$key]);
             }
         }
         if (in_array($CI->session->userdata('nation'), $this->licenses)) {
             $this->clear();
         }
     }
     // let's put the result in a small cache, since teams are always the same
     foreach ($this->all as $comic) {
         // if it's not yet cached, let's cache it
         if (!$this->get_cached($comic->id)) {
             if (count(self::$cached) > 10) {
                 array_shift(self::$cached);
             }
             self::$cached[] = $comic->get_clone();
         }
     }
     return $result;
 }
Пример #4
0
 public function get()
 {
     parent::get();
     if ($this->name == null) {
         throw new Task_Not_Found();
     }
 }
Пример #5
0
 public function __construct($id = null)
 {
     if (!is_null($id)) {
         $this->setID($id);
     }
     $this->validator = new Validator();
     $this->validator->setStoreErrors(true);
     $this->mapper = DataMapper::get(get_class($this));
 }
Пример #6
0
 /**
  * Overwrite of the get() function to add filters to the search.
  * Refer to DataMapper ORM for get() function details.
  *
  * @author	Woxxy
  * @param	integer|NULL $limit Limit the number of results.
  * @param	integer|NULL $offset Offset the results when limiting.
  * @return	DataMapper Returns self for method chaining.
  */
 public function get($limit = NULL, $offset = NULL)
 {
     // Get the CodeIgniter instance, since it isn't set in this file.
     $CI =& get_instance();
     // Check if the user is allowed to see protected chapters.
     if (!$CI->tank_auth->is_allowed()) {
         $this->where('hidden', 0);
     }
     return parent::get($limit, $offset);
 }
Пример #7
0
 /**
  * Overwrite of the get() function to add filters to the search.
  * Refer to DataMapper ORM for get() function details.
  *
  * @author	Woxxy
  * @param	integer|NULL $limit Limit the number of results.
  * @param	integer|NULL $offset Offset the results when limiting.
  * @return	DataMapper Returns self for method chaining.
  */
 public function get($limit = NULL, $offset = NULL)
 {
     // Get the CodeIgniter instance, since it isn't set in this file.
     $CI =& get_instance();
     // Check if the user is allowed to see protected chapters.
     if (!$CI->tank_auth->is_allowed()) {
         $this->where('hidden', 0);
     }
     $result = parent::get($limit, $offset);
     foreach ($this->all as $key => $item) {
         if (!$item->get_comic()) {
             unset($this->all[$key]);
         }
     }
     return $result;
 }
Пример #8
0
 /**
  * Overwrite of the get() function to add filters to the search.
  * Refer to DataMapper ORM for get() function details.
  *
  * @author	Woxxy
  * @param	integer|NULL $limit Limit the number of results.
  * @param	integer|NULL $offset Offset the results when limiting.
  * @return	DataMapper Returns self for method chaining.
  */
 public function get($limit = NULL, $offset = NULL)
 {
     $result = parent::get($limit, $offset);
     // let's put the result in a small cache, since teams are always the same
     if ($this->result_count() > 0) {
         foreach ($this->all as $team) {
             // if it's not yet cached, let's cache it
             if (!$this->get_cached($team->id)) {
                 if (count(self::$cached) > 10) {
                     array_shift(self::$cached);
                 }
                 self::$cached[] = $team->get_clone();
             }
         }
     }
     return $result;
 }
Пример #9
0
	/**
	 * Overwrite of the get() function to add filters to the search.
	 * Refer to DataMapper ORM for get() function details.
	 *
	 * @author	Woxxy
	 * @param	integer|NULL $limit Limit the number of results.
	 * @param	integer|NULL $offset Offset the results when limiting.
	 * @return	DataMapper Returns self for method chaining.
	 */
	public function get($limit = NULL, $offset = NULL) {
		// Get the CodeIgniter instance, since it isn't set in this file.
		$CI = & get_instance();

		// Check if the user is allowed to see protected chapters.
		if (!$CI->tank_auth->is_allowed()) {
			$this->where('hidden', 0);
		}

		$result = parent::get($limit, $offset);

		$this->get_licenses();

		$CI = & get_instance();

		if (!$CI->tank_auth->is_allowed() && !$CI->tank_auth->is_team()) {
		// Remove from the array the comics licensed in the user's nation
			foreach ($this->all as $key => $item) {
				if (in_array($CI->session->userdata('nation'), $this->licenses)) {
					unset($this->all[$key]);
				}
			}
			if (in_array($CI->session->userdata('nation'), $this->licenses)) {
				$this->clear();
			}
		}
			

		return $result;
	}
Пример #10
0
 /**
  * Get (overload)
  *
  * Get objects.
  *
  * @access	public
  * @param	int or array
  * @return	bool
  */
 function get($limit = NULL, $offset = NULL)
 {
     $this->_prepare_for_query();
     return parent::get($limit, $offset);
 }
Пример #11
0
 public function get($limit = NULL, $offset = NULL)
 {
     // reset changed relation
     if (!empty($this->parent)) {
         if (array_key_exists('object', $this->parent) && array_key_exists('this_field', $this->parent)) {
             $object = $this->parent['object'];
             $this_field = $this->parent['this_field'];
             if (array_key_exists($this_field, $object->original_related_values)) {
                 unset($object->original_related_values[$this_field]);
             }
             if (array_key_exists($this_field, $object->changed_related_values)) {
                 unset($object->changed_related_values[$this_field]);
             }
         }
     }
     return parent::get($limit, $offset);
 }
Пример #12
0
 public function get()
 {
     $return = parent::get();
     $this->checkForAchieveOrNot();
     $this->_setDoneTime();
     return $return;
 }
Пример #13
0
 function get_deteted($limit = NULL, $offset = NULL)
 {
     $this->where('status', STATUS_DELETED);
     parent::get($limit, $offset);
 }
Пример #14
0
 public function get_slim($limit = NULL, $offset = NULL)
 {
     return parent::get($limit, $offset);
 }