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


PHP Team::result_count方法代码示例

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


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

示例1: Team

 function team_get()
 {
     // check that the id is at least a valid number
     $this->_check_id();
     // get the single team by id
     $team = new Team();
     $team->where('id', $this->get('id'))->limit(1)->get();
     if ($team->result_count() == 1) {
         $result = $team->to_array();
         $members = new Membership();
         // get members gives an actual object with ->profile_othervariable
         $memb = $members->get_members($team->id);
         // we have to select the user array manually because... we don't want to expose password hashes
         foreach ($memb->all as $key => $mem) {
             $result['members'][$key] = $mem->to_array(array('id', 'username'));
             $result['members'][$key]['display_name'] = $mem->profile_display_name;
             $result['members'][$key]['twitter'] = $mem->profile_twitter;
             $result['members'][$key]['bio'] = $mem->profile_bio;
         }
         // all good
         $this->response($result, 200);
         // 200 being the HTTP response code
     } else {
         // no team for this id
         $this->response(array('error' => _('Team could not be found')), 404);
     }
 }
开发者ID:KasaiDot,项目名称:FoOlSlide,代码行数:27,代码来源:members.php

示例2: Team

	function get_home_team() {
		$CI = & get_instance();
		if (isset($CI->fs_loaded->home_team))
			return $CI->fs_loaded->home_team;
		$hometeam = get_setting('fs_gen_default_team');
		$team = new Team();
		$team->where('name', $hometeam)->limit(1)->get();
		if ($team->result_count() < 1) {
			$team = new Team();
			$team->limit(1)->get();
		}

		return $team;
	}
开发者ID:Nakei,项目名称:FoOlSlide,代码行数:14,代码来源:options_helper.php

示例3: add_joint_via_name

 public function add_joint_via_name($teams)
 {
     $result = array();
     foreach ($teams as $team) {
         $tea = new Team();
         $tea->where('name', $team)->get();
         if ($tea->result_count() == 0) {
             set_notice('error', _('One of the named teams doesn\'t exist.'));
             log_message('error', 'add_joint_via_name: team does not exist');
             return false;
         }
         $result[] = $tea->id;
     }
     return $this->add_joint($result);
 }
开发者ID:KasaiDot,项目名称:FoOlSlide,代码行数:15,代码来源:joint.php

示例4: team

	public function team($stub = NULL) {
		if (is_null($stub))
			show_404();
		$team = new Team();
		$team->where('stub', $stub)->get();
		if ($team->result_count() < 1)
			show_404();

		$memberships = new Membership();
		$members = $memberships->get_members($team->id);

		$this->template->title(_('Team'));
		$this->template->set('team', $team);
		$this->template->set('members', $members);
		$this->template->build('team');
	}
开发者ID:Nakei,项目名称:FoOlSlide,代码行数:16,代码来源:reader.php

示例5: Team

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

		$team = new Team();
		$team->where('id', $this->get('id'))->limit(1)->get();

		if ($team->result_count() == 1) {
			$result = $team->to_array();
			$members = new Membership();
			$memb = $members->get_members($team->id);
			foreach($memb->all as $key => $mem) {
				$result['members'][$key] = $memb->to_array(array('id','username'));
				$result['members'][$key]['display_name'] = $memb->profile_display_name;
				$result['members'][$key]['twitter'] = $memb->profile_twitter;
				$result['members'][$key]['bio'] = $memb->profile_bio;
			}
			$this->response($result, 200); // 200 being the HTTP response code
		} else {
			$this->response(array('error' => _('Team could not be found')), 404);
		}
	}
开发者ID:Nakei,项目名称:FoOlSlide,代码行数:23,代码来源:members.php

示例6: Team

 function leave_leadership($team_stub)
 {
     $this->viewdata["navbar"] = "";
     $team = new Team();
     $team->where('stub', $team_stub)->get();
     if ($team->result_count() != 1) {
         show_404();
     }
     if (!$this->tank_auth->is_team_leader($team->id) && !$this->tank_auth->is_allowed()) {
         show_404();
     }
     if ($this->input->post()) {
         $member = new Membership();
         if (!$member->remove_team_leader($team->id)) {
             return show_404();
         }
         redirect('/account/teams/');
     }
     $this->viewdata["function_title"] = _("Leave team leadership");
     $data["team_name"] = $team->name;
     $data["team_id"] = $team->id;
     $this->viewdata["main_content_view"] = $this->load->view('account/profile/leave_leadership', $data, TRUE);
     $this->load->view("account/default.php", $this->viewdata);
 }
开发者ID:KasaiDot,项目名称:FoOlSlide,代码行数:24,代码来源:index.php

示例7: get_teams_id

 public function get_teams_id($array, $create_joint = FALSE)
 {
     if (count($array) < 1) {
         set_notice('error', _('There were no groups selected.'));
         log_message('error', 'get_groups: input array empty');
         return false;
     }
     if (count($array) == 1) {
         $team = new Team();
         $team->where("name", $array[0])->get();
         if ($team->result_count() < 1) {
             set_notice('error', _('There\'s no team under this ID.'));
             log_message('error', 'get_groups: team not found');
             return false;
         }
         $result = array("team_id" => $team->id, "joint_id" => 0);
         return $result;
     }
     if (count($array) > 1) {
         $id_array = array();
         foreach ($array as $key => $arra) {
             $team = new Team();
             $team->where('name', $arra[$key])->get();
             if ($team->result_count() < 1) {
                 set_notice('error', _('There\'s no teams under this ID.'));
                 log_message('error', 'get_groups: team not found');
                 return false;
             }
             $id_array[$key] = $team->id;
         }
         $joint = new Joint();
         if (!$joint->check_joint($id_array) && $create_joint) {
             if (!$joint->add_joint($id_array)) {
                 log_message('error', 'get_groups: could not create new joint');
                 return false;
             }
         }
         return array("team_id" => 0, "joint_id" => $joint->joint_id);
     }
     set_notice('error', _('There\'s no group found with this ID.'));
     log_message('error', 'get_groups: no case matched');
     return false;
 }
开发者ID:KasaiDot,项目名称:FoOlSlide,代码行数:43,代码来源:team.php

示例8: update_chapter_db

	/**
	 * Handles both creating of new chapters in the database and editing old ones.
	 * It determines if it should update or not by checking if $this->id has
	 * been set. It can get the values from both the $data array and direct 
	 * variable assignation. Be aware that array > variables. The latter ones
	 * will be overwritten. Particularly, the variables that the user isn't
	 * allowed to set personally are unset and reset with the automated values.
	 * It's quite safe to throw stuff at it.
	 *
	 * @author	Woxxy
	 * @param	array $data contains the minimal data
	 * @return	object the comic the chapter derives from.
	 */
	public function update_chapter_db($data = array()) {
		// Check if we're updating or creating a new chapter by looking at $data["id"].
		// False is returned if the chapter ID was not found.
		if (isset($data["id"]) && $data['id'] != "") {
			$this->where("id", $data["id"])->get();
			if ($this->result_count() == 0) {
				set_notice('error', _('The chapter you tried to edit doesn\'t exist.'));
				log_message('error', 'update_chapter_db: failed to find requested id');
				return false;
			}
			// Save the stub in case it gets changed (different chapter number/name etc.)
			// Stub is always automatized.
			$old_stub = $this->stub;
		}
		else { // if we're here, it means that we're creating a new chapter
			// Set the creator name if it's a new chapter.	
			if (!isset($this->comic_id)) {
				set_notice('error', 'You didn\'t select a comic to refer to.');
				log_message('error', 'update_chapter_db: comic_id was not set');
				return false;
			}

			// Check that the related comic is defined, and exists.
			$comic = new Comic($this->comic_id);
			if ($comic->result_count() == 0) {
				set_notice('error', _('The comic you were referring to doesn\'t exist.'));
				log_message('error', 'update_chapter_db: comic_id does not exist in comic database');
				return false;
			}

			// Set the creator. This happens only on new chapter creation.
			$this->creator = $this->logged_id();
		}

		// Always set the editor
		$this->editor = $this->logged_id();

		// Unset the sensible variables. 
		// Not even admins should touch these, for database stability.
		unset($data["creator"]);
		unset($data["editor"]);
		unset($data["uniqid"]);
		unset($data["stub"]);
		unset($data["team_id"]);
		unset($data["joint_id"]);

		// Loop over the array and assign values to the variables.
		foreach ($data as $key => $value) {
			$this->$key = $value;
		}

		// Double check that we have all the necessary automated variables
		if (!isset($this->uniqid))
			$this->uniqid = uniqid();
		if (!isset($this->stub))
			$this->stub = $this->stub();

		// This is necessary to make the checkbox work.
		/**
		 *  @todo make the checkbox work consistently across the whole framework
		 */
		if (!isset($data['hidden']) || $data['hidden'] != 1)
			$this->hidden = 0;

		// Prepare a new stub.
		$this->stub = $this->chapter . '_' . $this->subchapter . '_' . $this->name;
		// stub() is also able to restub the $this->stub. Already stubbed values won't change.
		$this->stub = $this->stub();

		// If the new stub is different from the old one (if the chapter was 
		// already existing), rename the folder.
		if (isset($old_stub) && $old_stub != $this->stub) {
			$this->get_comic();
			$dir_old = "content/comics/" . $this->comic->directory() . "/" . $old_stub . "_" . $this->uniqid;
			$dir_new = "content/comics/" . $this->comic->directory() . "/" . $this->stub . "_" . $this->uniqid;
			rename($dir_old, $dir_new);
		}


		// $data['team'] must be an array of team NAMES
		if (isset($data['team'])) {
			// Remove the empty values in the array of team names.
			// It happens that the POST contains extra empty values.
			if (is_array($data['team'])) {
				foreach ($data['team'] as $key => $value) {
					if ($value == "") {
						unset($data['team'][$key]);
//.........这里部分代码省略.........
开发者ID:Nakei,项目名称:FoOlSlide,代码行数:101,代码来源:chapter.php

示例9: Team

	function team_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;

		$team = new Team();
		$team->where('id', $this->get('id'))->limit(1)->get();

		if ($team->result_count() == 1) {
			$result = array();
			$result['team'] = $team->to_array();

			// get joints to get also the chapters from joints
			$joints = new Joint();
			$joints->where('team_id', $team->id)->get();


			$chapters = new Chapter();
			$chapters->where('team_id', $team->id);
			foreach ($joints->all as $joint) {
				$chapters->or_where('joint_id', $joint->joint_id);
			}
			$chapters->limit(100, $page)->get();
			$chapters->get_comic();

			$result['chapters'] = array();
			foreach ($chapters->all as $key => $chapter) {
				if (!$chapter->team_id) {
					$chapter->get_teams();
					foreach ($chapter->teams as $item) {
						$result['chapters'][$key]['teams'][] = $item->to_array();
					}
				} else {
						$result['chapters'][$key]['teams'][] = $team->to_array();
				}
				$result['chapters'][$key]['comic'] = $chapter->comic->to_array();
				$result['chapters'][$key]['chapter'] = $chapter->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,代码行数:51,代码来源:reader.php

示例10: Team

 /**
  * Returns chapters per page from team ID
  * Includes releases from joints too
  * 
  * This is NOT a method light enough to lookup teams. use api/members/team for that
  * 
  * Available filters: id (required), page, per_page (default:30, max:100), orderby
  * 
  * @author Woxxy
  */
 function team_get()
 {
     // get the single team by id or stub
     if ($this->get('stub')) {
         $team = new Team();
         $team->where('stub', $this->get('stub'))->limit(1)->get();
     } else {
         // check that the id is at least a valid number
         $this->_check_id();
         $team = new Team();
         $team->where('id', $this->get('id'))->limit(1)->get();
     }
     // team found?
     if ($team->result_count() == 1) {
         $result = array();
         $result['team'] = $team->to_array();
         // get joints to get also the chapters from joints
         $joints = new Joint();
         $joints->where('team_id', $team->id)->get();
         $chapters = new Chapter();
         // get all chapters with the team ID
         $chapters->where('team_id', $team->id);
         foreach ($joints->all as $joint) {
             // get also all chapters with the joints by the team
             $chapters->or_where('joint_id', $joint->joint_id);
         }
         // filter for the page and the order
         $this->_orderby($chapters);
         $this->_page_to_offset($chapters);
         $chapters->get();
         $chapters->get_comic();
         // let's save some power by reusing the variables we already have for team
         // and put everything in the usual clean [comic][chapter][teams]
         $result['chapters'] = array();
         foreach ($chapters->all as $key => $chapter) {
             if (!$chapter->team_id) {
                 $chapter->get_teams();
                 foreach ($chapter->teams as $item) {
                     $result['chapters'][$key]['teams'][] = $item->to_array();
                 }
             } else {
                 $result['chapters'][$key]['teams'][] = $team->to_array();
             }
             $result['chapters'][$key]['comic'] = $chapter->comic->to_array();
             $result['chapters'][$key]['chapter'] = $chapter->to_array();
         }
         // all good
         $this->response($result, 200);
         // 200 being the HTTP response code
     } else {
         // that single team id wasn't found
         $this->response(array('error' => _('Team could not be found')), 404);
     }
 }
开发者ID:KasaiDot,项目名称:FoOlSlide,代码行数:64,代码来源:reader.php

示例11: get_teams

	public function get_teams($team_id, $joint_id = 0) {
		if ($joint_id > 0) {
			$joint = new Joint();
			$joint->where("joint_id", $joint_id)->get();
			if ($joint->result_count() < 1) {
				log_message('error', 'get_teams: joint -> joint not found');
				return false;
			}

			$teamarray = array();
			$team = new Team();
			foreach ($joint->all as $key => $join) {
				$team->where('id', $join->team_id);
				$team->get();
				$teamarray[] = $team->get_clone();
			}

			if ($team->result_count() < 1) {
				log_message('error', 'get_teams: joint -> no teams found');
				return false;
			}

			return $teamarray;
		}

		$team = new Team($team_id);
		return array($team);
	}
开发者ID:Nakei,项目名称:FoOlSlide,代码行数:28,代码来源:team.php

示例12: teams

 function teams($stub = "")
 {
     // no team selected
     if ($stub == "") {
         // set subtitle
         $this->viewdata["function_title"] = _('Teams');
         // we can use get_iterated on teams
         $teams = new Team();
         // support filtering via search
         if ($this->input->post()) {
             $teams->ilike('name', $this->input->post('search'));
             $this->viewdata['extra_title'][] = _('Searching') . " : " . $this->input->post('search');
         }
         $teams->order_by('name', 'ASC')->get_iterated();
         $rows = array();
         // produce links for each team
         foreach ($teams as $team) {
             $rows[] = array('title' => '<a href="' . site_url('admin/members/teams/' . $team->stub) . '">' . $team->name . '</a>');
         }
         // put in a list the teams
         $data['form_title'] = _('Teams');
         $data['table'] = lister($rows);
         // print out
         $this->viewdata["main_content_view"] = $this->load->view('admin/members/users', $data, TRUE);
         $this->load->view("admin/default", $this->viewdata);
     } else {
         // team was selected, let's grab it and create a form for it
         $team = new Team();
         $team->where('stub', $stub)->get();
         // if the team was not found return 404
         if ($team->result_count() != 1) {
             show_404();
         }
         // if admin or mod allow full editing rights
         if ($this->tank_auth->is_allowed()) {
             $can_edit = true;
         } else {
             $can_edit = false;
         }
         // if it's a team leader, but not admin or mod, allow him to change data but not the team name
         if ($this->tank_auth->is_team_leader($team->id) && !$can_edit) {
             $can_edit_limited = true;
         } else {
             $can_edit_limited = false;
         }
         // if allowed in any way to edit,
         if (($post = $this->input->post()) && ($can_edit || $can_edit_limited)) {
             $post["id"] = $team->id;
             // save the stub in case it's changed
             $old_stub = $team->stub;
             // don't allow editing of name for team leaders
             if ($can_edit_limited) {
                 unset($post['name']);
             }
             // send the data to database
             $team->update_team($post);
             // green box to tell data is saved
             set_notice('notice', _('Saved.'));
             if ($team->stub != $old_stub) {
                 flash_notice('notice', _('Saved.'));
                 redirect('admin/members/teams/' . $team->stub);
             }
         }
         // subtitle
         $this->viewdata["function_title"] = '<a href="' . site_url("admin/members/teams") . '">' . _('Teams') . '</a>';
         // subsubtitle!
         $this->viewdata["extra_title"][] = $team->name;
         // gray out the name field for team leaders by editing directly the validation array
         if ($can_edit_limited) {
             $team->validation['name']['disabled'] = 'true';
         }
         // convert the team information to an array
         $result = ormer($team);
         // convert the array to a form
         $result = tabler($result, TRUE, $can_edit || $can_edit_limited);
         $data['table'] = $result;
         $data['team'] = $team;
         // get the team's members
         $members = new Membership();
         $users = $members->get_members($team->id);
         // the team members' array needs lots of buttons and links
         $users_arr = array();
         foreach ($users->all as $key => $item) {
             $users_arr[$key][] = '<a href="' . site_url('/admin/members/member/' . $item->id) . '">' . $item->username . '</a>';
             // show the email only to admins and mods
             if ($can_edit) {
                 $users_arr[$key][] = $item->email;
             }
             $users_arr[$key][] = $item->last_login;
             // leader of normal member?
             $users_arr[$key][] = $item->is_leader ? _('Leader') : _('Member');
             if ($this->tank_auth->is_team_leader($team->id) || $this->tank_auth->is_allowed()) {
                 $buttoner = array();
                 $buttoner = array('text' => _("Remove member"), 'href' => site_url('/admin/members/reject_application/' . $team->id . '/' . $item->id), 'plug' => _('Do you want to remove this team member?'));
             }
             // add button to array or stay silent if there's no button
             $users_arr[$key]['action'] = isset($buttoner) && !empty($buttoner) ? buttoner($buttoner) : '';
             if (!$item->is_leader && ($this->tank_auth->is_team_leader($team->id) || $this->tank_auth->is_allowed())) {
                 $buttoner = array();
                 $buttoner = array('text' => _("Make leader"), 'href' => site_url('/admin/members/make_team_leader/' . $team->id . '/' . $item->id), 'plug' => _('Do you want to make this user a team leader?'));
//.........这里部分代码省略.........
开发者ID:KasaiDot,项目名称:FoOlSlide,代码行数:101,代码来源:members.php


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