Ejemplo n.º 1
0
 /**
  * Static function to display form for the field type
  * @param string $name
  * @param string $value
  * @param string $css
  * @return html for the form containing the field
  */
 public static function display_field($name, $idfield, $value = '', $css = 'form-control input-sm')
 {
     $combo_values = new ComboValues();
     $combo_values->get_combo_values($idfield);
     echo '<select class="' . $css . '" name = "' . $name . '" id="' . $name . '">' . "\n";
     if ($combo_values->getNumRows() > 0) {
         while ($combo_values->next()) {
             $select = '';
             if ($value == $combo_values->combo_value) {
                 $select = 'Selected';
             }
             echo '<option value = "' . $combo_values->combo_option . '" ' . $select . '>' . $combo_values->combo_value . '</option>' . "\n";
         }
     }
     echo '</select>';
 }
Ejemplo n.º 2
0
 /**
  * Static function to display form for the field type
  * @param string $name
  * @param string $value
  * @param string $css
  * @return html for the form containing the field
  */
 public static function display_field($name, $idfield, $value = '', $css = '')
 {
     $combo_values = new ComboValues();
     $combo_values->get_combo_values($idfield);
     if ($value != '') {
         $val_to_array = explode(",", $value);
     }
     echo '<select class="' . $css . '" name = "' . $name . '[]" id="' . $name . '" size= 5 multiple>' . "\n";
     if ($combo_values->getNumRows() > 0) {
         while ($combo_values->next()) {
             $select = '';
             if ($value != '' && in_array($combo_values->combo_value, $val_to_array)) {
                 $select = 'Selected';
             }
             echo '<option value = "' . $combo_values->combo_option . '" ' . $select . '>' . $combo_values->combo_value . '</option>' . "\n";
         }
     }
     echo '</select>';
 }
Ejemplo n.º 3
0
 /**
  * function to edit the custom field
  * @param object $evctl
  * @see popups/edit_custom_field_modal.php
  */
 public function eventEditCustomField(EventControler $evctl)
 {
     $idfields = (int) $evctl->idfields_ed;
     $update_data = false;
     if ($idfields > 0) {
         $this->getId($idfields);
         if ($this->getNumRows() > 0) {
             $update_data = true;
         } else {
             $update_data = false;
             $_SESSION["do_crm_messages"]->set_message('error', _('Record does not exit.'));
         }
     } else {
         $update_data = false;
         $_SESSION["do_crm_messages"]->set_message('error', _('Record does not exit.'));
     }
     if ($update_data === true) {
         $custom_field_type = $evctl->custom_field_type_ed;
         $req = $evctl->cf_req_ed;
         $field_validation = array();
         $is_required = false;
         if ($req == 'on') {
             $is_required = true;
             $field_validation["required"] = true;
         }
         switch ($custom_field_type) {
             case 1:
                 if ($is_required === true) {
                     if ($evctl->cf_max_len_ed != '' || (int) $evctl->cf_max_len_ed > 0) {
                         $field_validation["maxlength"] = (int) $evctl->cf_max_len_ed;
                     }
                     if ($evctl->cf_min_len_ed != '' || (int) $evctl->cf_min_len_ed > 0) {
                         $field_validation["minlength"] = (int) $evctl->cf_min_len_ed;
                     }
                 }
                 break;
             case 5:
                 $pick_values = $evctl->cf_pick_ed;
                 $not_equal = $evctl->cf_pick_notequal_ed;
                 if ($is_required === true) {
                     $field_validation["notEqual"] = $not_equal;
                 }
                 break;
             case 6:
                 $pick_values = $evctl->cf_pick_ed;
                 break;
         }
         if (count($field_validation) > 0) {
             $field_validation_entry = json_encode($field_validation);
         } else {
             $field_validation_entry = '';
         }
         $qry_update = "\n\t\t\tupdate " . $this->getTable() . " \n\t\t\tset `field_label` = ?,\n\t\t\t`field_validation` = ?\n\t\t\twhere idfields = ?";
         $this->query($qry_update, array(CommonUtils::purify_input($evctl->cf_label_ed), $field_validation_entry, $idfields));
         if ($custom_field_type == 5 || $custom_field_type == 6) {
             //$pick_values_seperated = explode(PHP_EOL,$evctl->cf_pick);
             $pick_values_seperated = preg_split('/[\\r\\n]+/', $evctl->cf_pick_ed, -1, PREG_SPLIT_NO_EMPTY);
             $do_combo_values = new ComboValues();
             $do_combo_values->update_combo_values($idfields, $pick_values_seperated);
         }
         $_SESSION["do_crm_messages"]->set_message('success', _('Custom field updated successfully !'));
     }
 }
Ejemplo n.º 4
0
<?php

// Copyright SQCRM. For licensing, reuse, modification and distribution see license.txt
/**
* Pick List/ Multi select combo values manage page
* @author Abhik Chakraborty
*/
$do_crm_fields = new CRMFields();
$do_combo_values = new ComboValues();
$non_editable_combo_fields = $do_combo_values->get_non_editable_combo_fields();
// modules which does not have the custom fields or any fields
$ignore_modules = array(1, 8, 9);
if (isset($_GET["cmid"]) && $_GET["cmid"] != '') {
    $cf_module = (int) $_GET["cmid"];
} else {
    $cf_module = 3;
}
$modules_info = $_SESSION["do_module"]->get_modules_with_full_info();
$do_crm_fields->get_pick_multiselect_fields($cf_module);
$data_array = array();
if ($do_crm_fields->getNumRows() > 0) {
    while ($do_crm_fields->next()) {
        $combo_data = array();
        if (in_array($do_crm_fields->idfields, $non_editable_combo_fields)) {
            continue;
        }
        $do_combo_values->get_combo_values($do_crm_fields->idfields);
        if ($do_combo_values->getNumRows() > 0) {
            $combo_data = array();
            while ($do_combo_values->next()) {
                $combo_data[] = $do_combo_values->combo_value;
Ejemplo n.º 5
0
* Change password modal
* @author Abhik Chakraborty
*/
include_once "config.php";
$idmodule = (int) $_GET["idmodule"];
$referrar = $_GET["referrar"];
$idfields = (int) $_GET["sqrecord"];
$do_custom_fields = new CustomFields();
$do_custom_fields->getId($idfields);
$field_validation = $do_custom_fields->field_validation;
$field_validation_data = array();
if ($field_validation != '') {
    $field_validation_data = json_decode($field_validation, true);
}
if ($do_custom_fields->field_type == 5 || $do_custom_fields->field_type == 6) {
    $do_combo_values = new ComboValues();
    $do_combo_values->get_combo_values($idfields);
    $pick_data = '';
    while ($do_combo_values->next()) {
        $pick_data .= $do_combo_values->combo_value . "\n";
        //adding new lines for the text area in pick options
    }
}
$allow = true;
$e_add = new Event("CustomFields->eventEditCustomField");
echo '<form class="form-horizontal" id="CustomFields__eventEditCustomField" name="CustomFields__eventEditCustomField" action="/eventcontroler.php" method="post">';
echo $e_add->getFormEvent();
?>
<div class="modal-dialog" role="document">
	<div class="modal-content">
		<div class="modal-header">