コード例 #1
0
 /**
  * Reset cover back to it original position
  *
  * @params $guid: User guid
  *
  * @return bool;
  */
 public function ResetCoverPostition($guid)
 {
     $this->statement("SELECT * FROM ossn_entities WHERE(\n\t\t\t\t             owner_guid='{$guid}' AND \n\t\t\t\t             type='user' AND \n\t\t\t\t             subtype='cover_position');");
     $this->execute();
     $entity = $this->fetch();
     $position = array('', '');
     $fields = new OssnEntities();
     $fields->owner_id = $guid;
     $fields->guid = $entity->guid;
     $fields->type = 'user';
     $fields->subtype = 'cover_position';
     $fields->value = json_encode($position);
     if ($fields->updateEntity()) {
         return true;
     }
     return false;
 }
コード例 #2
0
/**
 * Ossn update entity
 *
 * @param int $guid Entity guid
 * @param string $value Entity new value
 *
 * @return bool
 */
function ossn_update_entity($guid, $value)
{
    $update = new OssnEntities();
    $update->guid = $guid;
    $update->value = $value;
    return $update->updateEntity();
}
コード例 #3
0
 /**
  * Reposition group cover
  *
  * @param $guid Group guid
  *        $top  Position from top
  *        $left Position from left
  *
  * @return bool;
  * @access public;
  */
 public function repositionCOVER($guid, $top, $left)
 {
     $user = ossn_get_group_by_guid($guid);
     if (!isset($user->cover) && empty($user->cover)) {
         $position = array($top, $left);
         $fields = new OssnEntities();
         $fields->owner_guid = $guid;
         $fields->type = 'object';
         $fields->subtype = 'cover';
         $fields->value = json_encode($position);
         if ($fields->add()) {
             return true;
         }
     } else {
         $this->statement("SELECT * FROM ossn_entities WHERE(\n\t\t\t\t             owner_guid='{$guid}' AND\n\t\t\t\t             type='object' AND\n\t\t\t\t             subtype='cover');");
         $this->execute();
         $entity = $this->fetch();
         $entity_id = $entity->guid;
         $position = array($top, $left);
         $fields = new OssnEntities();
         $fields->owner_id = $guid;
         $fields->guid = $entity_id;
         $fields->type = 'object';
         $fields->subtype = 'cover';
         $fields->value = json_encode($position);
         if ($fields->updateEntity()) {
             return true;
         }
     }
     return false;
 }