当前位置: 首页>>代码示例>>PHP>>正文


PHP Team::get_teams方法代码示例

本文整理汇总了PHP中Team::get_teams方法的典型用法代码示例。如果您正苦于以下问题:PHP Team::get_teams方法的具体用法?PHP Team::get_teams怎么用?PHP Team::get_teams使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Team的用法示例。


在下文中一共展示了Team::get_teams方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: get_bulk

 /**
  * Comodity get() function that fetches extra data for the chapter selected.
  * It doesn't get the pages. For pages, see: $this->get_pages()
  *
  * @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_bulk($limit = NULL, $offset = NULL)
 {
     // Call the get()
     $result = $this->get($limit, $offset);
     // Return instantly on false.
     if (!$result) {
         return $result;
     }
     // For each item we fetched, add the data, beside the pages
     foreach ($this->all as $item) {
         $item->comic = new Comic($this->comic_id);
         $teams = new Team();
         $item->teams = $teams->get_teams($this->team_id, $this->joint_id);
     }
     return $result;
 }
开发者ID:KasaiDot,项目名称:FoOlSlide,代码行数:25,代码来源:page.php

示例2: Team

	function joint_get() {
		if (!$this->get('id') || !is_numeric($this->get('id'))) {
			$this->response(NULL, 400);
		}

		$team = new Team();
		$teams = $team->get_teams(0, $this->get('id'));

		if (count($teams) > 0) {
			$result = array();
			foreach($teams as $item) {
				$result[] = $item->to_array();
			}
			$this->response($result, 200); // 200 being the HTTP response code
		} else {
			$this->response(array('error' => _('Team could not be found')), 404);
		}
	}
开发者ID:Nakei,项目名称:FoOlSlide,代码行数:18,代码来源:members.php

示例3: Team

 function joint_get()
 {
     // check that the id is at least a valid number
     $this->_check_id();
     // get the single team by id
     $team = new Team();
     $teams = $team->get_teams(0, $this->get('id'));
     if (count($teams) > 0) {
         $result = array();
         // teams is a normal array, can't use all_to_array()
         foreach ($teams as $item) {
             $result[] = $item->to_array();
         }
         $this->response($result, 200);
         // 200 being the HTTP response code
     } else {
         // no team found
         $this->response(array('error' => _('Team could not be found')), 404);
     }
 }
开发者ID:KasaiDot,项目名称:FoOlSlide,代码行数:20,代码来源:members.php

示例4: serie

 function serie($stub = NULL, $chapter_id = "")
 {
     $comic = new Comic();
     $comic->where("stub", $stub)->get();
     if ($comic->result_count() == 0) {
         set_notice('warn', _('Sorry, the series you are looking for does not exist.'));
         $this->manage();
         return false;
     }
     $this->viewdata["function_title"] = '<a href="' . site_url('/admin/series/manage/') . '">' . _('Manage') . '</a>';
     if ($chapter_id == "") {
         $this->viewdata["extra_title"][] = $comic->name;
     }
     $data["comic"] = $comic;
     if ($chapter_id != "") {
         if ($this->input->post()) {
             $chapter = new Chapter();
             $chapter->update_chapter_db($this->input->post());
             $subchapter = is_int($chapter->subchapter) ? $chapter->subchapter : 0;
             set_notice('notice', sprintf(_('Information for Chapter %s has been updated.'), $chapter->chapter . '.' . $subchapter));
         }
         $chapter = new Chapter($chapter_id);
         $data["chapter"] = $chapter;
         $team = new Team();
         $teams = $team->get_teams($chapter->team_id, $chapter->joint_id);
         $table = ormer($chapter);
         $table[] = array(_('Teams'), array('name' => 'team', 'type' => 'input', 'value' => $teams, 'help' => _('Insert the names of the teams who worked on this chapter.')));
         $table = tabler($table);
         $data["table"] = $table;
         $this->viewdata["extra_title"][] = '<a href="' . site_url('admin/series/series/' . $comic->stub) . '">' . $comic->name . '</a>';
         $this->viewdata["extra_title"][] = $chapter->name != "" ? $chapter->name : $chapter->chapter . "." . $chapter->subchapter;
         $data["pages"] = $chapter->get_pages();
         $this->viewdata["main_content_view"] = $this->load->view("admin/series/chapter.php", $data, TRUE);
         $this->load->view("admin/default.php", $this->viewdata);
         return true;
     }
     if ($this->input->post()) {
         // Prepare for stub change in case we have to redirect instead of just printing the view
         $old_comic_stub = $comic->stub;
         $comic->update_comic_db($this->input->post());
         $config['upload_path'] = 'content/cache/';
         $config['allowed_types'] = 'jpg|png|gif';
         $this->load->library('upload', $config);
         $field_name = "thumbnail";
         if (count($_FILES) > 0 && $this->upload->do_upload($field_name)) {
             $up_data = $this->upload->data();
             if (!$this->files_model->comic_thumb($comic, $up_data)) {
                 log_message("error", "Controller: series.php/serie: image failed being added to folder");
             }
             if (!unlink($up_data["full_path"])) {
                 log_message('error', 'series.php/serie: couldn\'t remove cache file ' . $data["full_path"]);
                 return false;
             }
         }
         flash_notice('notice', sprintf(_('Updated series information for %s.'), $comic->name));
         // Did we change the stub of the comic? We need to redirect to the new page then.
         if (isset($old_comic_stub) && $old_comic_stub != $comic->stub) {
             redirect('/admin/series/series/' . $comic->stub);
         }
     }
     $chapters = new Chapter();
     $chapters->where('comic_id', $comic->id)->include_related('team')->order_by('volume', 'DESC')->order_by('chapter', 'DESC')->order_by('subchapter', 'DESC')->get();
     foreach ($chapters->all as $key => $item) {
         if ($item->joint_id > 0) {
             $teams = new Team();
             $jointers = $teams->get_teams(0, $item->joint_id);
             $item->jointers = $jointers;
             unset($jointers);
             unset($teams);
         }
     }
     $data["chapters"] = $chapters;
     if ($comic->get_thumb()) {
         $comic->thumbnail = $comic->get_thumb();
     }
     $table = ormer($comic);
     $licenses = new License();
     $table[] = array(_('Licensed in'), array('name' => 'licensed', 'type' => 'nation', 'value' => $licenses->get_by_comic($comic->id), 'help' => _('Insert the nations where the series is licensed in order to limit the availability.')));
     $table = tabler($table);
     $data['table'] = $table;
     $this->viewdata["main_content_view"] = $this->load->view("admin/series/series.php", $data, TRUE);
     $this->load->view("admin/default.php", $this->viewdata);
 }
开发者ID:bonsoirval,项目名称:FoOlSlide,代码行数:83,代码来源:series.php

示例5: get_teams

	/**
	 * Sets the $this->teams variable if it hasn't been done before
	 *
	 * @author	Woxxy
	 * @return	boolean True on success, false on failure.
	 */
	public function get_teams() {
		if (isset($this->teams))
			return true;
		$teams = new Team();
		$this->teams = $teams->get_teams($this->team_id, $this->joint_id);
		foreach ($this->all as $item) {
			if (isset($item->teams))
				continue;
			$teams = new Team();
			$item->teams = $teams->get_teams($item->team_id, $item->joint_id);
		}

		// All good, return true.
		return true;
	}
开发者ID:Nakei,项目名称:FoOlSlide,代码行数:21,代码来源:chapter.php

示例6: Team

 /**
  * Returns leader team objects, false in case user is not a team leader
  * 
  * @author Woxxy
  * @param int $team_id if NULL returns each team in which this user is leader
  * @return object Teams
  * 
  */
 function is_team_leader($team_id = NULL, $joint_id = NULL)
 {
     // not logged in? get booted
     if (!$this->is_logged_in()) {
         return FALSE;
     }
     // this calls another function in order to cycle each team in the joint with is_team
     if (!is_null($joint_id) && $joint_id != 0) {
         $teams = new Team();
         return $this->is_team_leader_array($teams->get_teams(0, $joint_id));
     }
     // let's get all the memberships
     if (!isset($this->cached['leaderships'])) {
         $memberships = new Membership();
         $memberships->where('user_id', $this->get_user_id())->where('accepted', 1)->where('is_leader', 1)->get();
         $this->cached['leaderships'] = $memberships->get_clone();
     } else {
         $memberships = $this->cached['leaderships'];
     }
     // if not member of any team, return FALSE
     if ($memberships->result_count() < 1) {
         return FALSE;
     }
     // if a team is set, let's grab the team and return the data of the team
     if (is_numeric($team_id)) {
         foreach ($memberships->all as $membership) {
             if ($membership->team_id == $team_id) {
                 return new Team($team_id);
             }
         }
         return FALSE;
     }
     $teams = new Team();
     // Notice that if you remove the result count on $leaderships, this will not run and the user will be leader of any team!
     foreach ($memberships->all as $key => $membership) {
         $teams->or_where('id', $membership->team_id);
     }
     $teams->get();
     return $teams;
 }
开发者ID:KasaiDot,项目名称:FoOlSlide,代码行数:48,代码来源:Tank_auth.php

示例7: Joint

	function joint_get() {
		if (!$this->get('id') || !is_numeric($this->get('id'))) {
			$this->response(NULL, 400);
		}

		if (!$this->get('page') || !is_numeric($this->get('page')) || $this->get('page') < 1)
			$page = 1;
		else
			$page = (int) $this->get('page');

		$page = ($page * 100) - 100;

		$joint = new Joint();
		$joint->where('joint_id', $this->get('id'))->limit(1)->get();

		if ($joint->result_count() == 1) {

			$team = new Team();
			$teams = $team->get_teams(0, $this->get('id'));

			$result = array();
			foreach ($teams as $item) {
				$result['teams'][] = $item->to_array();
			}

			$chapters = new Chapter();
			$chapters->where('joint_id', $joint->joint_id);
			$chapters->limit(100, $page)->get();
			$chapters->get_comic();

			$result['chapters'] = array();
			foreach ($chapters->all as $key => $chapter) {
				$result['chapters'][$key]['comic'] = $chapter->comic->to_array();
				$result['chapters'][$key]['chapter'] = $chapter->to_array();
				$result['chapters'][$key]['teams'] = $result['teams'];
			}

			$this->response($result, 200); // 200 being the HTTP response code
		} else {
			$this->response(array('error' => _('Team could not be found')), 404);
		}
	}
开发者ID:Nakei,项目名称:FoOlSlide,代码行数:42,代码来源:reader.php

示例8: Joint

 /**
  * Returns chapters per page by joint ID
  * Also returns the teams
  * 
  * This is not a method light enough to lookup teams. use api/members/joint for that
  * 
  * Available filters: id (required), page, per_page (default:30, max:100), orderby
  * 
  * @author Woxxy
  */
 function joint_get()
 {
     // check that the id is at least a valid number
     $this->_check_id();
     // grab by joint_id, id for joints means nothing much
     $joint = new Joint();
     $joint->where('joint_id', $this->get('id'))->limit(1)->get();
     if ($joint->result_count() == 1) {
         // good old get_teams() will give us all Team objects in an array
         $team = new Team();
         $teams = $team->get_teams(0, $this->get('id'));
         // $teams is a normal array, so we have to do a loop
         $result = array();
         foreach ($teams as $item) {
             $result['teams'][] = $item->to_array();
         }
         // grab all the chapters from the same joint
         $chapters = new Chapter();
         $chapters->where('joint_id', $joint->joint_id);
         // apply the limit and orderby filters
         $this->_orderby($chapters);
         $this->_page_to_offset($chapters);
         $chapters->get();
         $chapters->get_comic();
         // let's put the chapters in a nice [comic][chapter][teams] list
         $result['chapters'] = array();
         foreach ($chapters->all as $key => $chapter) {
             $result['chapters'][$key]['comic'] = $chapter->comic->to_array();
             $result['chapters'][$key]['chapter'] = $chapter->to_array();
             $result['chapters'][$key]['teams'] = $result['teams'];
         }
         // all good
         $this->response($result, 200);
         // 200 being the HTTP response code
     } else {
         // nothing for this joint or page
         $this->response(array('error' => _('Team could not be found')), 404);
     }
 }
开发者ID:KasaiDot,项目名称:FoOlSlide,代码行数:49,代码来源:reader.php

示例9: Team

	/**
	 * Returns team objects of the user, false in case no team
	 * 
	 * @author Woxxy
	 * @returns object Teams
	 * 
	 */
	function is_team($team_id = NULL, $joint_id = NULL) {
		if (!$this->is_logged_in())
			return false;
		
		if(!is_null($joint_id) && $joint_id != 0)
		{
			$teams = new Team();
			return($this->is_team_array($teams->get_teams(0, $joint_id)));
		}

		$memberships = new Membership();
		$memberships->where('user_id', $this->get_user_id())->where('accepted', 1);

		if (is_numeric($team_id)) {
			$memberships->where('team_id', $team_id);
			$memberships->get();
			if ($memberships->result_count() != 1)
				return false;
			$team = new Team();
			$team->where('id', $team_id)->get();
			return $team;
		}

		$memberships->get();
		if ($memberships->result_count() < 1)
			return false;
		$teams = new Team();
		// Notice that if you remove the result count on $leaderships, this will not run and the user will be leader of any team!
		foreach ($memberships->all as $key => $membership) {
			$teams->or_where('id', $membership->team_id);
		}
		$teams->get();
		return $teams;
	}
开发者ID:Nakei,项目名称:FoOlSlide,代码行数:41,代码来源:Tank_auth.php


注:本文中的Team::get_teams方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。