Ejemplo n.º 1
0
 public function testGetAttributes()
 {
     $allAttributes = ContactWebFormsUtil::getAllAttributes();
     $this->assertNotEmpty($allAttributes);
     $allPlacedAttributes = ContactWebFormsUtil::getAllPlacedAttributes($allAttributes);
     $allNonPlacedAttributes = ContactWebFormsUtil::getAllNonPlacedAttributes($allAttributes);
     $this->assertTrue(count($allPlacedAttributes) < count($allNonPlacedAttributes));
     $selectiveAttributes = array('firstName', 'lastName', 'companyName', 'jobTitle');
     $allPlacedAttributes = ContactWebFormsUtil::getAllPlacedAttributes($allAttributes, $selectiveAttributes);
     $this->assertEquals(count($selectiveAttributes), count($allPlacedAttributes));
 }
 /**
  * @return string
  */
 protected function renderControlEditable()
 {
     $attributes = ContactWebFormsUtil::getAllAttributes();
     $contactWebFormAttributes = array();
     if (isset($this->model->serializedData)) {
         $contactWebFormAttributes = unserialize($this->model->serializedData);
     }
     $clip = $this->form->checkBoxList($this->model, $this->attribute, ContactWebFormsUtil::getAllNonPlacedAttributes($attributes, $contactWebFormAttributes), $this->getEditableHtmlOptions());
     $title = ZurmoHtml::tag('h3', array(), Zurmo::t('ContactWebFormModule', 'Available Fields'));
     $content = ZurmoHtml::tag('span', array('class' => 'row-description'), Zurmo::t('ContactWebFormModule', 'Check the fields that you like to add to your form, you can then change their order or remove them'));
     $content .= ZurmoHtml::tag('div', array('class' => 'third'), $title . $clip);
     $cClipWidget = new CClipWidget();
     $cClipWidget->beginClip("attributesList");
     $cClipWidget->widget('application.core.widgets.JuiSortable', array('itemTemplate' => $this->renderItemTemplate(), 'items' => ContactWebFormsUtil::getAllPlacedAttributes($attributes, $contactWebFormAttributes)));
     $cClipWidget->endClip();
     $clip = $cClipWidget->getController()->clips['attributesList'];
     $title = ZurmoHtml::tag('h3', array(), Zurmo::t('ContactWebFormModule', 'Chosen Fields'));
     $content .= ZurmoHtml::tag('div', array('class' => 'twoThirds'), $title . $clip);
     $this->registerScript();
     return $content;
 }