public function __construct()
 {
     gateKeeper();
     $user = getLoggedInUser();
     $user->createAvatar();
     if (isEnabledPlugin("photos")) {
         $album = getEntity(array("type" => "Photoalbum", "metadata_name_value_pairs" => array(array("name" => "owner_guid", "value" => getLoggedInUserGuid()), array("name" => "title", "value" => "Profile Avatars"))));
         $photo = new Photo();
         $photo->owner_guid = getLoggedInUserGuid();
         $photo_guid = $photo->save();
         Image::copyAvatar($user, $photo);
         $photo = getEntity($photo_guid);
         if (!$album) {
             $album = new Photoalbum();
             $album->owner_guid = getLoggedInUserGuid();
             $album->title = "Profile Avatars";
             $album_guid = $album->save();
             $album = getEntity($album_guid);
             Image::copyAvatar($photo, $album);
         }
         $photo->container_guid = $album->guid;
         $photo->save();
     }
     runHook("action:edit_avatar:after", array("user" => $user));
     new Activity(getLoggedInUserGuid(), "activity:avatar:updated", array($user->getURL(), $user->full_name));
     new SystemMessage("Your avatar has been uploaded.");
     forward("profile/" . $user->guid);
 }
 public function __construct()
 {
     $title = getInput("title");
     $description = getInput("description");
     $access_id = getInput("access_id");
     Security::checkForEmptyFields(array("title"));
     $logged_in_user = getLoggedInUser();
     $logged_in_user_guid = $logged_in_user->guid;
     $album = new Photoalbum();
     $album->title = $title;
     $album->description = $description;
     $album->owner_guid = $logged_in_user_guid;
     $album->access_id = $access_id;
     $album->save();
     $album->createAvatar();
     new Activity(getLoggedInUserGuid(), "activity:add:photo:album", array(getLoggedInUser()->getURL(), getLoggedInUser()->full_name, $album->getURL(), $album->title, "<a href='" . $album->getURL() . "'>" . $album->icon(EXTRALARGE, "img-responsive") . "</a>"));
     new SystemMessage("Your album has been created.");
     forward("photos");
 }
Пример #3
0
function createPhotoAlbum($params)
{
    $description = "";
    $title = $params['title'];
    if (isset($params['description'])) {
        $description = $params['description'];
    }
    if (isset($params['access_id'])) {
        $access_id = $params['access_id'];
    } else {
        $access_id = "public";
    }
    $owner_guid = $params['owner_guid'];
    $album = new Photoalbum();
    $album->title = $title;
    $album->description = $description;
    $album->owner_guid = $owner_guid;
    $album->access_id = $access_id;
    if (isset($params['image'])) {
        $album->icon = uploadBase64Image($params['image']);
    }
    $album->save();
    $user = getEntity($owner_guid);
    new Activity($owner_guid, "activity:add:photo:album", array($user->getURL(), $user->full_name, $album->getURL(), $album->title, "<a href='" . $album->getURL() . "'>" . $album->icon(EXTRALARGE, "img-responsive") . "</a>"));
    return $album->guid;
}