$test = array('0' => 'None'); $contactlist = array_merge($test, $contactlist); echo CHtml::dropDownList('parent_company', $mrw['parent_contact_id'], $contactlist, array('prompt' => 'Select Parent Company', 'title' => "Non-child companies are only visible.")); ?> </td> </tr> <tr style="display: none;"> <td align="right"> <label for='contact_group'><?php $clang->eT("Contact Group* : "); ?> </label> </td> <td> <?php $cgroup = Contact_group::model()->findAll(); $cgrouplist = CHtml::listData($cgroup, 'contact_group_id', 'contact_group_name'); $firstctype = array_keys($cgrouplist); echo CHtml::dropDownList('contact_group', $mrw['contact_group_id'], $cgrouplist, array('prompt' => 'Select Contact group')); ?> </td> </tr> <!-- <tr> <td align="right"> <label for='company_type'><?php $clang->eT("Contact Type* : "); ?> </label> </td> <td> <?php
/** * Modify User POST */ function modcontact_group() { $clang = Yii::app()->lang; // old Details $contact_group_id = (int) Yii::app()->request->getPost("contact_group_id"); $contact_group_name = flattenText(Yii::app()->request->getPost("contact_group_name")); $IsActive = flattenText(Yii::app()->request->getPost("IsActive")); //New Name $c_group_name = flattenText(Yii::app()->request->getPost("c_group_name")); $addsummary = ''; $aViewUrls = array(); $is_Active = 0; if ($IsActive) { $is_Active = 1; } $sresult = Contact_group::model()->findAllByAttributes(array('contact_group_id' => $contact_group_id)); $sresultcount = count($sresult); if (Permission::model()->hasGlobalPermission('superadmin', 'read') || $sresultcount > 0 && Permission::model()->hasGlobalPermission('contacts', 'update')) { if ($c_group_name == '') { $aViewUrls['mboxwithredirect'][] = $this->_messageBoxWithRedirect($clang->gT("Editing Contact Group"), $clang->gT("Could not modify Contact Group."), "warningheader", $clang->gT("Contact Group name not be empty."), $this->getController()->createUrl('admin/contact_group/sa/modifycontact_group'), $clang->gT("Back"), array('contact_group_id' => $contact_group_id)); } elseif (Contact_group::model()->findByAttributes(array('contact_group_name' => $c_group_name, 'IsActive' => $is_Active))) { $aViewUrls['message'] = array('title' => $clang->gT("Failed to add Contact Group"), 'message' => $clang->gT("The Contact Group already exists."), 'class' => 'warningheader'); } else { $oRecord = Contact_group::model()->findByPk($contact_group_id); $oRecord->contact_group_name = $this->escape($c_group_name); $oRecord->IsActive = $this->escape($is_Active); $uresult = $oRecord->save(); // store result of save in uresult if ($uresult) { // When saved successfully Yii::app()->setFlashMessage($clang->gT("Contact Group updated successfully")); $this->getController()->redirect(array("admin/contact_group/index")); } else { //Saving the user failed for some reason, message about email is not helpful here // Username and/or email adress already exists. $aViewUrls['mboxwithredirect'][] = $this->_messageBoxWithRedirect($clang->gT("Editing contact group"), $clang->gT("Could not modify contact group."), 'warningheader'); } } } else { Yii::app()->setFlashMessage(Yii::app()->lang->gT("You do not have sufficient rights to access this page."), 'error'); $this->getController()->redirect(array("admin/index")); } $this->_renderWrappedTemplate('contacts/contact_group', $aViewUrls); }