Пример #1
0
 public function __construct(Database $database, Container $application)
 {
     parent::__construct($database, $application);
     //"label"=>"","datatype"=>"","charsize"=>"" , "default"=>"", "index"=>TRUE, "allowempty"=>FALSE
     $this->definePropertyModel(array("collection_title" => array("Collection Title", "mediumtext", 100), "collection_items" => array("Collection Items", "longtext", 2000), "collection_thumbnail" => array("Collection Thumbnail", "mediumtext", 200), "collection_size" => array("Collection Size", "smallint", 10), "collection_description" => array("Collection Description", "mediumtext", 200), "collection_tags" => array("Collection Tags", "mediumtext", 100), "collection_owner" => array("Collection Owner", "mediumtext", 100)), "collection");
     //$this->definePropertyModel( $dataModel ); use this to set a new data models or use extendPropertyModel to extend existing models
     //$this->defineValueGroup("attachment"); //Tell the system we are using a proxy table
 }
Пример #2
0
 public function __construct(Container $application, Database $database, Session $session)
 {
     $this->encryptor = $application->encrypt;
     $this->config = $application->config;
     $this->database = $database;
     $this->session = $session;
     parent::__construct($database, $application);
     //"label"=>"","datatype"=>"","charsize"=>"" , "default"=>"", "index"=>TRUE, "allowempty"=>FALSE
     $this->extendPropertyModel(array("user_first_name" => array("First Name", "mediumtext", 50), "user_middle_name" => array("Middle Name", "mediumtext", 50), "user_last_name" => array("Last Name", "mediumtext", 50), "user_name_id" => array("Username", "mediumtext", 50), "user_password" => array("Password", "varchar", 2000), "user_api_key" => array("API Key", "varchar", 100), "user_email" => array("Email", "varchar", 100), "user_dob_day" => array("Day of Birth", "varchar", 10), "user_dob_month" => array("Month of Birth", "varchar", 10), "user_dob_year" => array("Year of Birth", "varchar", 10), "user_timezone" => array("Timezone", "varchar", 10), "user_locale" => array("Locale", "varchar", 10), "user_verification" => array("Verification Code", "varchar", 50), "user_photo" => array("Profile Photo", "mediumtext", 10, 'placeholder'), "user_twitter_uid" => array("Twitter Account Id", "mediumtext", 50), "user_facebook_uid" => array("Facebook Account Id", "mediumtext", 50), "user_twitter_token" => array("Twitter AccessToken", "varchar", 2000), "user_facebook_token" => array("Facebook AccessToken", "varchar", 2000), "user_google_uid" => array("Google Account Id", "mediumtext", 50), "user_google_token" => array("Google AccessToken", "varchar", 2000), "user_dropbox_uid" => array("Dropbox Account Id", "mediumtext", 50), "user_dropbox_token" => array("Dropbox AccessToken", "varchar", 2000)), "user");
     //$this->definePropertyModel( $dataModel ); use this to set a new data models
     $this->defineValueGroup("user");
     //Tell the system we are using a proxy table
 }
Пример #3
0
 private function bindData(Entity $page)
 {
     $inputModel = $page->getPropertyModel();
     // print_R($_POST);
     foreach ($inputModel as $property => $definition) {
         $value = $this->application->input->getString($property, "", "post");
         if (!empty($value)) {
             $page->setPropertyValue($property, $value);
         }
     }
     //Allow some HTML in media content;
     $mediaContent = $this->application->input->getFormattedString("media_content", "", "post", true);
     $page->setPropertyValue("media_content", $mediaContent);
     return $page;
 }
Пример #4
0
 /**
  * Wraps a media entity with accesorry data, like author, attachments, targets, etc...
  * 
  * @param type $object
  * @return type
  */
 public function getObject(Entity $subject)
 {
     //1. getActor
     //Media Object;;
     //First get the nature of the media object;
     //        if(!is_object($subject)&& !is_a($subject, Entity::class)):
     //            $subjectEntity = Platform\Entity::getInstance(); //An empty entity here because it is impossible to guess the properties of this object
     //            $subject = $subjectEntity->loadObjectByURI($subject, array()); //Then we load the object
     //        endif;
     $object = NULL;
     $mediaObjectURI = $subject->getObjectURI();
     if (!empty($mediaObjectURI)) {
         //Create an media object, and fire an event asking callbacks to complete the media object
         $mediaSubject = new Object();
         $mediaObjectType = $subject->getObjectType();
         //Fire the event, passing the mediaSubject by reference
         //Although it looks stupid to need to find out the nature of the media subject before trigger
         //It actually provides an extra exclusion for callback so not all callbacks go to the database
         //so for instance if we found an media subject was a collection, callbacks can first check if the
         //trigger is to model a collection before diving ing
         //\Library\Event::trigger("onMediaSubjectModel", $mediaSubject, $subject);
         //You never know what callbacks will do to your subject so we just check
         //that the media subject is what we think it is, i.e an media object
         if (is_object($mediaSubject) && method_exists($mediaSubject, "getArray")) {
             $object = $mediaSubject::getArray();
             //If it is then we can set the media object output vars
         }
     } else {
         //If there no explicitly defined mediaObjects, in media_object
         //parse media_content for medialinks
         //Parse media targets medialinks
         //@todo;
         // $mediaLinks = Media\MediaLink::parse($data);
     }
     return $object;
 }