本文整理汇总了PHP中Pack::count方法的典型用法代码示例。如果您正苦于以下问题:PHP Pack::count方法的具体用法?PHP Pack::count怎么用?PHP Pack::count使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Pack
的用法示例。
在下文中一共展示了Pack::count方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: view
public function view($id = null)
{
if (empty($id)) {
redirect('packs');
} else {
if (Pack::count(array('conditions' => array('id = ?', $id))) == 0) {
redirect('packs');
} else {
$this->data['pack'] = Pack::get_single_pack_info($id);
$this->data['subtitle'] = $this->data['pack']->name;
$this->data['songs'] = Ranked_file::all(array('conditions' => array("pack_id = ?", $id), 'order' => "rate ASC"));
if (isset($_GET['recalc'])) {
error_reporting(E_ALL ^ E_DEPRECATED ^ E_NOTICE ^ E_WARNING);
set_time_limit(0);
foreach ($this->data['songs'] as $file) {
$calculated_difficulty = $this->_process_everything($file->raw_file, $file->rate);
$file->difficulty_score = $calculated_difficulty;
}
}
$this->content_view = 'packs/view';
}
}
}
示例2: packname_unique
public function packname_unique($pack_name)
{
$this->set_message('packname_unique', "The pack you're trying to enter already exists.");
return Pack::count(array('conditions' => array('name = ?', $pack_name))) == 0;
}
示例3: delete_pack
function delete_pack($pack_id)
{
if (Pack::count(array('conditions' => array('id = ?', $pack_id))) != 1) {
redirect('home');
}
$this->content_view = "mod/delete_pack_success";
$pack = Pack::find($pack_id);
$pack_name = $pack->name;
$pack->delete();
$log_string = $this->session->userdata('username') . " (" . $this->session->userdata('display_name') . ") deleted pack: " . $pack_name;
write_to_mod_log($log_string);
}