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


PHP Reservation::load_user方法代码示例

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


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

示例1: competition_create

    public static function competition_create($courts, $name, $from, $to, $fromt, $tot, $reservations_delete = false, $admin_username)
    {
        global $DB;
        $ret = array();
        if (!is_array($courts) || count($courts) == 0) {
            $ret['success'] = false;
            $ret['error'] = 'Nincs kiválasztva pálya!';
            $ret['error_type'] = 1;
        } elseif ($name == "") {
            $ret['success'] = false;
            $ret['error'] = 'A rendezvény nevének megadása kötelező!';
            $ret['error_type'] = 2;
        } elseif (strtotime($to) < strtotime($from)) {
            $ret['success'] = false;
            $ret['error'] = 'A dátum intervallum hibás!';
            $ret['error_type'] = 3;
        } elseif (TimeUnit::convert_to_minutes($tot) <= TimeUnit::convert_to_minutes($fromt)) {
            $ret['success'] = false;
            $ret['error'] = 'Az idő intervallum hibás!';
            $ret['error_type'] = 4;
        } else {
            $where = '
					(timeunits.date BETWEEN :from_date AND :to_date) AND 
					(
						(timeunits.from>=:from AND timeunits.from<:to)
							OR
						(timeunits.to>:from AND timeunits.to<=:to)
					) AND
					timeunits.court_id IN (' . implode(',', $courts) . ')
				';
            $sql = '
					SELECT
						COUNT(*) as c
					FROM timeunits
					WHERE
						' . $where . ' AND
						reserved_by IS NOT NULL AND
						1=1
				';
            $sth = $DB->prepare($sql);
            $sth->bindParam(':from_date', $from, PDO::PARAM_STR);
            $sth->bindParam(':to_date', $to, PDO::PARAM_STR);
            $sth->bindParam(':from', $fromt, PDO::PARAM_STR);
            $sth->bindParam(':to', $tot, PDO::PARAM_STR);
            $sth->execute();
            $c = $sth->fetchColumn();
            if ($c > 0 && $reservations_delete === false) {
                $ret['success'] = false;
                $ret['error'] = 'A kijelölt időszakban van lefoglalt idősáv. A foglalások törléséhez pipálja be a "foglalások törlése" jelölőnégyzetet.';
                $ret['error_type'] = 5;
            } else {
                if ($reservations_delete === true) {
                    // foglalások törlése
                    $sql = '
							SELECT
								reservations.*
							FROM reservations
							LEFT JOIN timeunits ON (reservations.timeunit_id=timeunits.id)
							WHERE
								' . $where . ' AND
								reserved_by IS NOT NULL AND
								1=1
						';
                    $sth = $DB->prepare($sql);
                    $sth->bindParam(':from_date', $from, PDO::PARAM_STR);
                    $sth->bindParam(':to_date', $to, PDO::PARAM_STR);
                    $sth->bindParam(':from', $fromt, PDO::PARAM_STR);
                    $sth->bindParam(':to', $tot, PDO::PARAM_STR);
                    $sth->execute();
                    foreach ($sth->fetchAll() as $tmp) {
                        $res = new Reservation($tmp);
                        $res->load_timeunit();
                        $res->load_user();
                        $res->is_freeable(true);
                        $res->free($admin_username);
                    }
                }
                $sql = '
						UPDATE timeunits
						SET
							comment=:name,
							available=0
						WHERE
							' . $where . '
					';
                $sth = $DB->prepare($sql);
                $sth->bindParam(':name', $name, PDO::PARAM_STR);
                $sth->bindParam(':from_date', $from, PDO::PARAM_STR);
                $sth->bindParam(':to_date', $to, PDO::PARAM_STR);
                $sth->bindParam(':from', $fromt, PDO::PARAM_STR);
                $sth->bindParam(':to', $tot, PDO::PARAM_STR);
                $sth->execute();
                $ret['success'] = true;
            }
        }
        return $ret;
    }
开发者ID:hunor42,项目名称:kispestse-palyafoglalas,代码行数:97,代码来源:TimeUnit.php


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