public function __construct($source = null, $entry = null)
 {
     if ($entry && (is_object($entry) || is_array($entry))) {
         if (is_array($entry)) {
             $entry = Zend_Ldap_Node::fromArray($entry);
         }
         $this->node = $entry;
         $attrs = $entry->getAttributes(false);
         foreach ($attrs as $attr => $value) {
             $this->remoteProperties[$attr] = $value;
         }
         if (isset($this->uid)) {
             $this->Title = is_array($this->uid) ? implode($this->uid) : $this->uid;
         } else {
             if (isset($this->cn)) {
                 $this->Title = is_array($this->cn) ? implode($this->cn) : $this->cn;
             } else {
                 if (isset($this->ou)) {
                     $this->Title = is_array($this->ou) ? implode($this->ou) : $this->ou;
                 } else {
                     $this->Title = $entry->getCurrentDN();
                 }
             }
         }
         $this->DN = $entry->getCurrentDN();
         parent::__construct($source, $entry->getCurrentDn());
     } else {
         parent::__construct($source, $entry);
     }
 }
 public function getCMSFields()
 {
     $fields = parent::getCMSFields();
     // Basic information
     $fields->fieldByName('Root.Main')->getChildren()->changeFieldOrder(array('MenuTitle', 'Description', 'Path', 'Href'));
     $fields->addFieldToTab('Root.Main', new ReadonlyField('DrupalID', 'Menu Link ID'), 'Title');
     $fields->removeByName('Options');
     // Details
     $optionsText = '(none)';
     $options = $this->Options->toMap();
     if ($options) {
         $optionsText = '';
         foreach ($options as $key => $value) {
             $optionsText .= "{$key} = {$value}, ";
         }
         $optionsText = substr($optionsText, 0, -2);
     }
     $fields->addFieldToTab('Root.Details', new ReadonlyField('OptionList', 'Options', $optionsText));
     $fields->addFieldsToTab('Root.Behaviour', array(new ReadonlyField('Hidden', 'Hidden', $this->Hidden), new ReadonlyField('External', 'External', $this->External), new ReadonlyField('HasChildren', 'HasChildren', $this->HasChildren), new ReadonlyField('Weight', 'Weight', $this->Weight), new ReadonlyField('Depth', 'Depth', $this->Depth)));
     if ($this->Node) {
         $fields->addFieldsToTab('Root.Node', array(new ReadonlyField('NodeDrupalID', 'Drupal ID', $this->Node->DrupalID), new ReadonlyField('NodeVersionID', 'Version ID', $this->Node->VersionID), new ReadonlyField('NodeCreatedAt', 'Created At', $this->Node->CreatedAt), new ReadonlyField('NodeModifiedAt', 'Modified At', $this->Node->ChangedAt), new ReadonlyField('NodeUserID', 'User ID', $this->Node->UserID), new ReadonlyField('NodeStatus', 'Status', $this->Node->Status), new ReadonlyField('NodeLanguage', 'Language', $this->Node->Language), new ReadonlyField('NodeTitle', 'Title', $this->Node->Title), new ReadonlyField('NodeBody', 'Body', $this->Node->Body)));
     }
     // Import
     $fields->addFieldsToTab('Root.Import', array(new TextField('BaseUrl', 'Drupal Base URL'), new CheckboxField('ImportMedia', 'Import and rewrite references to Drupal media?', true), new TextField('FileRelation', 'Relation on Page to import attached files into'), new TextField('AssetsPath', 'Upload Drupal files to', 'Uploads/Drupal')));
     if (class_exists('TaxonomyTerm')) {
         $fields->addFieldToTab('Root.Import', new TextField('TaxonomyRelation', 'Relation on Page to import taxonomy tags into'));
     }
     $fields->addFieldsToTab('Root.Import', array(new TextField('PageType', 'Page type to import into (leave blank for default)'), new CheckboxField('PublishOnImport', 'Publish pages after import?'), new CheckboxField('ImportPublishDates', 'Import created and last edited dates?')));
     return $fields;
 }
 public function __construct($source = null, $item = null)
 {
     if (is_array($item)) {
         $this->item = $item;
         $item = $item['itemId'];
     }
     parent::__construct($source, $item);
 }
 public function getCMSFields()
 {
     $fields = parent::getCMSFields();
     $categories = new TableListField('Categories', false, array('Label' => 'Label', 'Term' => 'Term', 'Scheme' => 'Scheme'));
     $categories->setCustomSourceItems($this->categories);
     $fields->addFieldsToTab('Root.Details', array(new HeaderField('CategoriesHeader', 'Categories', 4), $categories->performReadonlyTransformation()));
     $fields->addFieldsToTab('Root.Location', array(new ReadonlyField('Latitude', null, $this->Latitude), new ReadonlyField('Longitude', null, $this->Longitude)));
     $fields->addFieldToTab('Root.Behaviour', new ReadonlyField('ShowInMenus', null, $this->ShowInMenus));
     return $fields;
 }
 public function __construct($source = null, $id = null, $content = null)
 {
     if ($content) {
         $this->wrappedObject = $content;
         parent::__construct($source, $content->SS_ID . '-' . $content->ClassName);
     } else {
         if (is_bool($id)) {
             $id = 0;
         }
         parent::__construct($source, $id);
     }
 }
 public function __construct($source = null, $object = null)
 {
     parent::__construct($source, is_object($object) ? $object->id : $object);
     if (is_object($object)) {
         $createUser = isset($object->user) ? $object->user->screen_name : $object->from_user;
         $this->remoteProperties['Title'] = sprintf(_t('TwitterConnector.CREATED_AT', 'Created at %s by %s'), $object->created_at, $createUser);
         $this->remoteProperties['CreatedBy'] = $createUser;
         $this->remoteProperties['Tweet'] = $object->text;
         $this->remoteProperties['Created'] = $object->created_at;
         $this->remoteProperties['Link'] = 'http://twitter.com/' . $createUser . '/status/' . $object->id;
     }
 }
 public function getCMSFields()
 {
     $fields = parent::getCMSFields();
     $fields->addFieldToTab('Root.Details', new ReadonlyField('CategoryList', 'Categories', implode(', ', $this->Categories->map('Name', 'Name'))));
     $fields->addFieldsToTab('Root.Users', array(new ReadonlyField('UserID', 'User ID', $this->UserID), new ReadonlyField('Author', null, $this->Author), new ReadonlyField('AuthorID', 'Author ID', $this->AuthorID), new ReadonlyField('AuthorName', 'Author Name', $this->AuthorName)));
     $fields->addFieldsToTab('Root.Metadata', array(new ReadonlyField('Slug', null, $this->Slug), new ReadonlyField('Link', null, $this->Link), new ReadonlyField('Permalink', null, $this->Permalink)));
     $fields->addFieldsToTab('Root.Behaviour', array(new ReadonlyField('ParentID', 'Parent ID', $this->ParentID), new ReadonlyField('ParentTitle', 'Parent Title', $this->ParentTitle), new ReadonlyField('AllowComments', 'Allow Comments', $this->AllowComments), new ReadonlyField('AllowPings', 'Allow Pings', $this->AllowPings), new ReadonlyField('Password', null, $this->Password), new ReadonlyField('Template', null, $this->Template), new ReadonlyField('Order', null, $this->Order)));
     $fields->addFieldToTab('Root.CustomFields', $custom = new GridField('CustomFields', null, $this->CustomFields, new GridFieldConfig_RecordViewer()));
     $config = $custom->getConfig();
     $config->removeComponentsByType('GridFieldFilterHeader');
     $config->getComponentByType('GridFieldDataColumns')->setDisplayFields(array('ID' => 'ID', 'Key' => 'Key', 'Value' => 'Value'));
     return $fields;
 }
 public function getCMSFields()
 {
     $fields = parent::getCMSFields();
     $categoriesString = '';
     foreach ($this->categories as $cat) {
         //$categoriesString .= "<li>$cat->Label / $cat->Term / $cat->Scheme</li> \n";
         $categoriesString .= "<li>{$cat->Label}</li> \n";
     }
     $categoriesString = "<ul>{$categoriesString}</ul>";
     $fields->addFieldsToTab('Root.Main', array(new HeaderField('CategoriesHeader', 'Categories', 4), new LiteralField('Categories', $categoriesString)));
     $fields->addFieldsToTab('Root.Location', array(new ReadonlyField('Latitude', null, $this->Latitude), new ReadonlyField('Longitude', null, $this->Longitude)));
     $fields->addFieldToTab('Root.Behaviour', new ReadonlyField('ShowInMenus', null, $this->ShowInMenus));
     return $fields;
 }
 public function getCMSFields()
 {
     $fields = parent::getCMSFields();
     $fields->removeByName('DrupalID');
     $fields->removeByName('CreatedAt');
     $fields->removeByName('ChangedAt');
     $fields->removeByName('UserID');
     $fields->removeByName('Status');
     $fields->removeByName('Language');
     $fields->removeByName('Title');
     $fields->removeByName('Body');
     $fields->addFieldsToTab('Root.Node', array(new ReadonlyField('DrupalID', 'Drupal Node ID', $this->DrupalID), new ReadonlyField('Title', 'Title', $this->Title), new ReadonlyField('Body', 'Body', $this->Body), new ReadonlyField('CreatedAt', 'Created Date', $this->CreatedAt), new ReadonlyField('ChangedAt', 'Modified Date', $this->ChangedAt), new ReadonlyField('UserID', 'UserID', $this->UserID), new ReadonlyField('Status', 'Status', $this->Status), new ReadonlyField('Language', 'Language', $this->Language)));
     return $fields;
 }
 /**
  * On creation, bind to the cmisobj if provided
  * 
  * @param ExternalContentSource $source
  * 					Where this item was loaded from
  * @param Int $id
  * 					The Alfresco ID of this object
  */
 public function __construct($source = null, $id = null, $data = null)
 {
     parent::__construct($source, $id);
     if ($this->source) {
         if (!$data) {
             $repo = $this->source->getRemoteRepository();
             // lets load the object from the Alfresco repository and populate the 'remoteProperties' field
             $data = $repo->getAsset(array('id' => $id));
         }
         foreach ($data as $key => $value) {
             $this->remoteProperties[$key] = $value;
         }
         $this->Title = isset($this->remoteProperties['name']) ? $this->remoteProperties['name'] : 'No name';
         $this->MenuTitle = isset($this->remoteProperties['short_name']) ? $this->remoteProperties['short_name'] : $this->Title;
     }
 }
 public function getCMSFields()
 {
     $fields = parent::getCMSFields();
     $fields->addFieldToTab('Root.Details', new ReadonlyField('CategoryList', 'Categories', implode(', ', $this->Categories->map('Name', 'Name'))));
     $fields->addFieldsToTab('Root.Users', array(new ReadonlyField('UserID', 'User ID', $this->UserID), new ReadonlyField('AuthorID', 'Author ID', $this->AuthorID), new ReadonlyField('AuthorName', 'Author Name', $this->AuthorName)));
     $fields->addFieldsToTab('Root.Metadata', array(new ReadonlyField('Keywords', null, $this->Keywords), new ReadonlyField('Slug', null, $this->Slug), new ReadonlyField('Link', null, $this->Link), new ReadonlyField('Permalink', null, $this->Permalink)));
     $fields->addFieldsToTab('Root.Behaviour', array(new ReadonlyField('AllowComments', 'Allow Comments', $this->AllowComments), new ReadonlyField('AllowPings', 'Allow Pings', $this->AllowPings), new ReadonlyField('Password', null, $this->Password), new ReadonlyField('PostFormat', 'Post Format', $this->PostFormat), new ReadonlyField('Sticky', null, $this->Sticky)));
     $fields->addFieldToTab('Root.CustomFields', $custom = new GridField('CustomFields', null, $this->CustomFields, new GridFieldConfig_RecordViewer()));
     $config = $custom->getConfig();
     $config->removeComponentsByType('GridFieldFilterHeader');
     $config->getComponentByType('GridFieldDataColumns')->setDisplayFields(array('ID' => 'ID', 'Key' => 'Key', 'Value' => 'Value'));
     if (!class_exists('BlogEntry')) {
         $fields->addFieldToTab('Root.Import', new LiteralField('RequiresBlogImport', '<p>The Wordpress connector requires the blog module to import posts.</p>'));
     }
     return $fields;
 }
 /**
  * Creates a new content item based on data passed
  * through from a sharepoint server
  *
  * @param SharePointContentSource $source
  * @param String $id
  * @param StdClass $content
  */
 public function __construct($source = null, $id = null, $content = null)
 {
     if ($content) {
         $this->wrappedObject = $content;
         // make up a sharepoint ID based on the structure of a raw sharepoint
         // object
         $id = isset($content[SharePointClient::ID_IDX]) ? $content[SharePointClient::ID_IDX] : '';
         if (!$id) {
             throw new Exception("Cannot create object from invalid content: " . var_export($content, true));
         }
         parent::__construct($source, $id);
     } else {
         if (is_bool($id)) {
             $id = 0;
         }
         parent::__construct($source, $id);
     }
 }
 public function getCMSFields()
 {
     $fields = parent::getCMSFields();
     // Add the preview fields here, including rules used
     $t = new StaticSitePageTransformer();
     $urlField = new ReadonlyField("PreviewSourceURL", "Imported from", "<a href=\"{$this->AbsoluteURL}\">" . Convert::raw2xml($this->AbsoluteURL) . "</a>");
     $urlField->dontEscape = true;
     $fields->addFieldToTab("Root.Preview", $urlField);
     $content = $t->getContentFieldsAndSelectors($this);
     if (count($content) === 0) {
         return $fields;
     }
     foreach ($content as $k => $v) {
         $readonlyField = new ReadonlyField("Preview{$k}", "{$k}<br>\n<em>" . $v['selector'] . "</em>", $v['content']);
         $readonlyField->addExtraClass('readonly-click-toggle');
         $fields->addFieldToTab("Root.Preview", $readonlyField);
     }
     Requirements::javascript('staticsiteconnector/js/StaticSiteContentItem.js');
     Requirements::css('staticsiteconnector/css/StaticSiteContentItem.css');
     return $fields;
 }
 public function getCMSFields()
 {
     $fields = parent::getCMSFields();
     // Basic information
     $fields->fieldByName('Root.Main')->getChildren()->changeFieldOrder(array('TermName', 'Description'));
     $fields->addFieldToTab('Root.Main', new ReadonlyField('DrupalTermID', 'Term ID'), 'Name');
     $fields->removeByName('Parents');
     // Details
     $parentsText = '(none)';
     $parents = $this->Parents->toMap();
     if ($parents) {
         $parentsText = '';
         foreach ($parents as $key => $value) {
             $parentsText .= "{$value}, ";
         }
         $parentsText = substr($parentsText, 0, -2);
     }
     $fields->addFieldToTab('Root.Details', new ReadonlyField('ParentList', 'Parents', $parentsText));
     $fields->addFieldsToTab('Root.Behaviour', array(new ReadonlyField('VocabularyID', 'VocabularyID', $this->VocabularyID), new ReadonlyField('External', 'External', $this->External), new ReadonlyField('HasChildren', 'HasChildren', $this->HasChildren), new ReadonlyField('Weight', 'Weight', $this->Weight), new ReadonlyField('Depth', 'Depth', $this->Depth)));
     return $fields;
 }
 public function getCMSFields()
 {
     $fields = parent::getCMSFields();
     // Basic information
     $fields->fieldByName('Root.Main')->getChildren()->changeFieldOrder(array('MenuTitle', 'Description', 'Path', 'Href'));
     $fields->addFieldToTab('Root.Main', new ReadonlyField('DrupalMenuLinkID', 'Menu Link ID'), 'Title');
     $fields->removeByName('Options');
     // Details
     $optionsText = '(none)';
     $options = $this->Options->toMap();
     if ($options) {
         $optionsText = '';
         foreach ($options as $key => $value) {
             $optionsText .= "{$key} = {$value}, ";
         }
         $optionsText = substr($optionsText, 0, -2);
     }
     $fields->addFieldToTab('Root.Details', new ReadonlyField('OptionList', 'Options', $optionsText));
     $fields->addFieldsToTab('Root.Behaviour', array(new ReadonlyField('Hidden', 'Hidden', $this->Hidden), new ReadonlyField('External', 'External', $this->External), new ReadonlyField('HasChildren', 'HasChildren', $this->HasChildren), new ReadonlyField('Weight', 'Weight', $this->Weight), new ReadonlyField('Depth', 'Depth', $this->Depth)));
     return $fields;
 }
 /**
  * Override to let remote objects figure out whether they have a 
  * field or not
  * 
  * @see sapphire/core/model/DataObject#hasField($field)
  */
 public function hasField($field)
 {
     $existing = parent::hasField($field);
     // $val = $this->__get($field);
     // return !empty($val);
     return $existing || ($this->cmisObject ? $this->cmisObject->hasProperty($field) : false);
 }