Squiz Matrix  4.12.2
 All Data Structures Namespaces Functions Variables Pages
page_custom_form_ecommerce.inc
1 <?php
17 require_once SQ_PACKAGES_PATH.'/cms/page_templates/page_custom_form/page_custom_form.inc';
18 
31 {
32 
33 
44  function _createAdditional(&$link)
45  {
46  if (!page::_createAdditional($link)) return false;
47 
48  // create a new form_ecommerce (form with emailing abilities)
49  $GLOBALS['SQ_SYSTEM']->am->includeAsset('form_ecommerce');
50  $form = new Form_Ecommerce();
51  $copy_link = Array('asset' => &$this, 'link_type' => SQ_LINK_TYPE_2, 'is_dependant' => 1, 'is_exclusive' => 1);
52 
53  $form->setAttrValue('name', 'Ecommerce Form Contents');
54 
55  // We provide the parent id to the ecom form
56  // this id can be used while creating the asset and when getUrl is being used
57  // if the following line is removed, the creation of this asset under a folder
58  // with metadata field and the keyword %asset_url% will fail
59  $form->_tmp['parent_form_page_assetid'] =& $this->id;
60 
61  return $form->create($copy_link);
62 
63  }//end _createAdditional()
64 
65 
72  function _getAllowedLinks()
73  {
74  $page_links = parent::_getAllowedLinks();
75  //unset($page_links[SQ_LINK_TYPE_2]['form_email']);
76  $page_links[SQ_LINK_TYPE_2]['form_ecommerce'] = Array('card' => '1', 'exclusive' => true);
77 
78  return $page_links;
79 
80  }//end _getAllowedLinks()
81 
88  function printBody()
89  {
90  $form_link = $GLOBALS['SQ_SYSTEM']->am->getLink($this->id, SQ_LINK_TYPE_2, 'form_ecommerce', true, '', 'major');
91  $form = $GLOBALS['SQ_SYSTEM']->am->getAsset($form_link['minorid'], $form_link['minor_type_code']);
92 
93  if (is_null($form)) {
94  trigger_localised_error('ECOM0002', E_USER_ERROR, $this->name, $this->id);
95  return false;
96  }
97  $form->printBody();
98 
99  return true;
100 
101  }//end printBody()
102 
103 
104 }//end class
105 ?>