concrete/src/User/User.php
public function loadCollectionEdit(&$c)
    {
        $c->refreshCache();

        // can only load one page into edit mode at a time.
        if ($c->isCheckedOut()) {
            return false;
        }

        $app = Application::getFacadeApplication();
        $db = $app['database']->connection();

        $cID = $c->getCollectionID();
        // first, we check to see if we have a collection in edit mode. If we do, we relinquish it
        $this->unloadCollectionEdit(false);

        $q = 'select cIsCheckedOut, cCheckedOutDatetime from Pages where cID = ?';
        $r = $db->executeQuery($q, array($cID));
        if ($r) {
            $row = $r->fetchRow();
            if (!$row['cIsCheckedOut']) {
                $app['session']->set('editCID', $cID);
                $uID = $this->getUserID();
                $dh = $app->make('helper/date');
                $datetime = $dh->getOverridableNow();
                $q2 = 'update Pages set cIsCheckedOut = ?, cCheckedOutUID = ?, cCheckedOutDatetime = ?, cCheckedOutDatetimeLastEdit = ? where cID = ?';
                $r2 = $db->executeQuery($q2, array(1, $uID, $datetime, $datetime, $cID));

                $c->cIsCheckedOut = 1;
                $c->cCheckedOutUID = $uID;
                $c->cCheckedOutDatetime = $datetime;
                $c->cCheckedOutDatetimeLastEdit = $datetime;
            }
        }

        return true;
    }
public function loadCollectionEdit(&$c)
    {
        $c->refreshCache();

        // can only load one page into edit mode at a time.
        if ($c->isCheckedOut()) {
            return false;
        }

        $app = Application::getFacadeApplication();
        $db = $app['database']->connection();

        $cID = $c->getCollectionID();
        // first, we check to see if we have a collection in edit mode. If we do, we relinquish it
        $this->unloadCollectionEdit(false);

        $q = 'select cIsCheckedOut, cCheckedOutDatetime from Pages where cID = ?';
        $r = $db->executeQuery($q, array($cID));
        if ($r) {
            $row = $r->fetchRow();
            if (!$row['cIsCheckedOut']) {
                $app['session']->set('editCID', $cID);
                $uID = $this->getUserID();
                $dh = $app->make('helper/date');
                $datetime = $dh->getOverridableNow();
                $q2 = 'update Pages set cIsCheckedOut = ?, cCheckedOutUID = ?, cCheckedOutDatetime = ?, cCheckedOutDatetimeLastEdit = ? where cID = ?';
                $r2 = $db->executeQuery($q2, array(1, $uID, $datetime, $datetime, $cID));

                $c->cIsCheckedOut = 1;
                $c->cCheckedOutUID = $uID;
                $c->cCheckedOutDatetime = $datetime;
                $c->cCheckedOutDatetimeLastEdit = $datetime;
            }
        }

        return true;
    }
public function loadCollectionEdit ( & $ c ) { $ c -> refreshCache ( ) ; // can only load one page into edit mode at a time. if ( $ c -> isCheckedOut ( ) ) { return false ; } $ app = Application :: getFacadeApplication ( ) ; $ db = $ app [ 'database' ] -> connection ( ) ; $ cID = $ c -> getCollectionID ( ) ; // first, we check to see if we have a collection in edit mode. If we do, we relinquish it $ this -> unloadCollectionEdit ( false ) ; $ q = 'select cIsCheckedOut, cCheckedOutDatetime from Pages where cID = ?' ; $ r = $ db -> executeQuery ( $ q , array ( $ cID ) ) ; if ( $ r ) { $ row = $ r -> fetchRow ( ) ; if ( ! $ row [ 'cIsCheckedOut' ] ) { $ app [ 'session' ] -> set ( 'editCID' , $ cID ) ; $ uID = $ this -> getUserID ( ) ; $ dh = $ app -> make ( 'helper/date' ) ; $ datetime = $ dh -> getOverridableNow ( ) ; $ q2 = 'update Pages set cIsCheckedOut = ?, cCheckedOutUID = ?, cCheckedOutDatetime = ?, cCheckedOutDatetimeLastEdit = ? where cID = ?' ; $ r2 = $ db -> executeQuery ( $ q2 , array ( 1 , $ uID , $ datetime , $ datetime , $ cID ) ) ; $ c -> cIsCheckedOut = 1 ; $ c -> cCheckedOutUID = $ uID ; $ c -> cCheckedOutDatetime = $ datetime ; $ c -> cCheckedOutDatetimeLastEdit = $ datetime ; } } return true ; }
Loads a page in edit mode.

@param Page $c
@return bool
Loads a page in edit mode .