Webylon 3.2 API Docs
  • Package
  • Class
  • Tree
  • Deprecated
  • Download
Version: current
  • 3.2
  • 3.1

Packages

  • 1c
    • exchange
      • catalog
  • auth
  • Booking
  • building
    • company
  • cart
    • shipping
    • steppedcheckout
  • Catalog
    • monument
  • cms
    • assets
    • batchaction
    • batchactions
    • bulkloading
    • comments
    • content
    • core
    • export
    • newsletter
    • publishers
    • reports
    • security
    • tasks
  • Dashboard
  • DataObjectManager
  • event
  • faq
  • forms
    • actions
    • core
    • fields-basic
    • fields-dataless
    • fields-datetime
    • fields-files
    • fields-formatted
    • fields-formattedinput
    • fields-relational
    • fields-structural
    • transformations
    • validators
  • googlesitemaps
  • guestbook
  • installer
  • newsletter
  • None
  • photo
    • gallery
  • PHP
  • polls
  • recaptcha
  • sapphire
    • api
    • bulkloading
    • control
    • core
    • cron
    • dev
    • email
    • fields-formattedinput
    • filesystem
    • formatters
    • forms
    • i18n
    • integration
    • misc
    • model
    • parsers
    • search
    • security
    • tasks
    • testing
    • tools
    • validation
    • view
    • widgets
  • seo
    • open
      • graph
  • sfDateTimePlugin
  • spamprotection
  • stealth
    • captha
  • subsites
  • userform
    • pagetypes
  • userforms
  • webylon
  • widgets

Classes

  • AssetManager
  • CartTableListField_Item
  • ComplexTableField
  • ComplexTableField_Item
  • ComplexTableField_ItemRequest
  • ComplexTableField_Popup
  • CountryDropdownField
  • DataObjectManager
  • DataObjectManager_Item
  • DataObjectManager_ItemRequest
  • DocumentPageFiles_Manager
  • FileDataObjectManager
  • FileDataObjectManager_Item
  • FileDataObjectManager_ItemRequest
  • HasManyComplexTableField
  • HasManyComplexTableField_Item
  • HasManyDataObjectManager
  • HasManyDataObjectManager_Item
  • HasManyFileDataObjectManager
  • HasManyFileDataObjectManager_Item
  • HasOneComplexTableField
  • HasOneComplexTableField_Item
  • HasOneDataObjectManager
  • HasOneDataObjectManager_Item
  • HasOneFileDataObjectManager
  • HasOneFileDataObjectManager_Item
  • ImageAssetManager
  • ImageDataObjectManager
  • ImageDataObjectManager_Item
  • ImageDataObjectManager_ItemRequest
  • LanguageDropdownField
  • ManyManyComplexTableField
  • ManyManyComplexTableField_Item
  • ManyManyDataObjectManager
  • ManyManyDataObjectManager_Item
  • ManyManyFileDataObjectManager
  • ManyManyFileDataObjectManager_Item
  • Mediaweb3DPageFiles_Manager
  • MediawebPageFiles_Manager
  • MediawebPagePhoto_Manager
  • MediawebPageTexture_Manager
  • PhotoAlbumManager
  • ScaffoldingComplexTableField_Popup
  • SubpageListField_Item
  • SubPageListField_ItemRequest
  • SubsiteAgnosticTableListField
  • TableField
  • TableField_Item
  • TableListField
  • TableListField_Item
  • TableListField_ItemRequest
  • TreeDropdownField
  • TreeDropdownField_Readonly
  • TreeMultiselectField
  • TreeMultiselectField_Readonly
  • TreeSelectorField
 1 <?php
 2 /**
 3  * Used by ModelAdmin scaffolding, to manage many-many relationships. 
 4  *
 5  * @package forms
 6  * @subpackage fields-relational
 7  */
 8 class ScaffoldingComplexTableField_Popup extends ComplexTableField_Popup {
 9     
10     public static $allowed_actions = array(
11         'filter', 'record', 'httpSubmission', 'handleAction', 'handleField'
12     );
13 
14     function __construct($controller, $name, $fields, $validator, $readonly, $dataObject) {
15         $this->dataObject = $dataObject;
16         
17         Requirements::clear();
18 
19         $actions = new FieldSet();  
20         if(!$readonly) {
21             $actions->push(
22                 $saveAction = new FormAction("saveComplexTableField", "Save")
23             );  
24             $saveAction->addExtraClass('save');
25         }
26         
27         $fields->push(new HiddenField("ComplexTableField_Path", Director::absoluteBaseURL()));
28         
29         parent::__construct($controller, $name, $fields, $validator, $readonly, $dataObject);
30     }
31     
32     /**
33      * Handle a generic action passed in by the URL mapping.
34      *
35      * @param SS_HTTPRequest $request
36      */
37     public function handleAction($request) {
38         $action = str_replace("-","_",$request->param('Action'));
39         if(!$this->action) $this->action = 'index';
40         
41         if($this->checkAccessAction($action)) {
42             if($this->hasMethod($action)) {
43                 $result = $this->$action($request);
44             
45                 // Method returns an array, that is used to customise the object before rendering with a template
46                 if(is_array($result)) {
47                     return $this->getViewer($action)->process($this->customise($result));
48                 
49                 // Method returns a string / object, in which case we just return that
50                 } else {
51                     return $result;
52                 }
53             
54             // There is no method, in which case we just render this object using a (possibly alternate) template
55             } else {
56                 return $this->getViewer($action)->process($this);
57             }
58         } else {
59             return $this->httpError(403, "Action '$action' isn't allowed on class $this->class");
60         }       
61     }
62     
63     /**
64      * Action to render results for an autocomplete filter.
65      *
66      * @param SS_HTTPRequest $request
67      * @return void
68      */ 
69     function filter($request) {
70         //$model = singleton($this->modelClass);
71         $context = $this->dataObject->getDefaultSearchContext();
72         $value = $request->getVar('q');
73         $results = $context->getResults(array("Name"=>$value));
74         header("Content-Type: text/plain");
75         foreach($results as $result) {
76             echo $result->Name . "\n";
77         }       
78     }
79     
80     /**
81      * Action to populate edit box with a single data object via Ajax query
82      */
83     function record($request) {
84         $type = $request->getVar('type');
85         $value = $request->getVar('value');
86         if ($type && $value) {
87             $record = DataObject::get_one($this->dataObject->class, "\"$type\" = '$value'");
88             header("Content-Type: text/plain");
89             echo json_encode(array("record"=>$record->toMap()));
90         }
91     }
92 
93 }
94 ?>
[Raise a SilverStripe Framework issue/bug](https://github.com/silverstripe/silverstripe-framework/issues/new)
- [Raise a SilverStripe CMS issue/bug](https://github.com/silverstripe/silverstripe-cms/issues/new)
- Please use the Silverstripe Forums to ask development related questions. -
Webylon 3.2 API Docs API documentation generated by ApiGen 2.8.0