Ejemplo n.º 1
0
 /**
  * Get the collection of id/names of inputs and other
  * parts of the element.
  */
 public function getEditableNameIds()
 {
     $htmlOptions = array();
     ZurmoHtml::resolveNameID($this->model, $this->attribute, $htmlOptions);
     return array($htmlOptions['id']);
 }
 protected function renderDeleteLinkContent()
 {
     $htmlOptions = array();
     $attribute = 'savedSearchId';
     ZurmoHtml::resolveNameID($this->model, $attribute, $htmlOptions);
     // Begin Not Coding Standard
     Yii::app()->clientScript->registerScript('deleteSavedSearchAndRemoveFromViewScript', "\n                function deleteSavedSearchAndRemoveFromView(modelId)\n                {\n                        \$.ajax({\n                            url : '" . Yii::app()->createUrl('zurmo/default/deleteSavedSearch') . "?id=' + modelId,\n                            type : 'GET',\n                            dataType : 'json',\n                            success : function(data)\n                            {\n                               var inputId = '" . static::getSavedSearchListDropDown() . "';\n                               \$('#' + inputId + ' > option').each(function(){\n                                   if (this.value == modelId)\n                                   {\n                                       \$('#' + inputId + ' option[value=\\'' + this.value + '\\']').remove();\n                                   }\n                               });\n                               \$('#removeSavedSearch').remove();\n                               \$('#" . $htmlOptions['id'] . "').val('');\n                            },\n                            error : function()\n                            {\n                                //todo: error call\n                            }\n                        });\n                }\n            ", CClientScript::POS_END);
     // End Not Coding Standard
     if ($this->model->savedSearchId != null) {
         $label = Zurmo::t('Core', 'Delete') . "<span class='icon'></span>";
         return ZurmoHtml::link($label, "#", array('id' => 'removeSavedSearch', 'class' => 'remove', 'onclick' => "deleteSavedSearchAndRemoveFromView('" . $this->model->savedSearchId . "')"));
     }
 }