Пример #1
0
 /**
  * Function to get language
  * @return string language
  */
 static function getLanguage()
 {
     if (isset($GLOBALS['cfg_lang'])) {
         self::$lang = $GLOBALS['cfg_lang'];
     }
     return self::$lang;
 }
Пример #2
0
 /**
  * function to get data history display text
  * @param object $obj
  * @param boolean $link
  * @param boolean $user_history
  * @return array $ret_array
  */
 public function get_data_history_display_text($obj, $link = false, $user_history = false)
 {
     $row1 = '<strong>' . $obj->firstname . ' ' . $obj->lastname . '</strong> ' . _('on ') . '<i>' . i18nDate::i18n_long_time(TimeZoneUtil::convert_to_user_timezone($obj->date_modified, true)) . '</i>';
     switch ($obj->action) {
         case 'add':
             if ($user_history === true) {
                 $row2 = _('Added') . ' ' . CommonUtils::get_module_name_as_text($obj->idmodule);
             } else {
                 $row2 = _('Added the record');
             }
             break;
         case 'delete':
             if ($user_history === true) {
                 $row2 = _('Deleted') . ' ' . CommonUtils::get_module_name_as_text($obj->idmodule);
             } else {
                 $row2 = _('Deleted the record');
             }
             break;
         case 'edit':
             if ($user_history === true) {
                 $row2 = _('Updated') . ' ' . CommonUtils::get_module_name_as_text($obj->idmodule);
             } else {
                 $row2 = _('Updated the record');
             }
             break;
         case 'value_changes':
             $do_crm_fields = new CRMFields();
             $do_crm_fields->getId($obj->idfields);
             if ($do_crm_fields->getNumRows() > 0) {
                 $field_label = $do_crm_fields->field_label;
                 $old_value = $obj->old_value;
                 $new_value = $obj->new_value;
                 if ($do_crm_fields->field_type == 9) {
                     $old_value = FieldType9::display_value($old_value);
                     $new_value = FieldType9::display_value($new_value);
                 }
                 if ($user_history === true) {
                     $row2 = _('Changed value in') . ' ' . CommonUtils::get_module_name_as_text($obj->idmodule) . ' , ' . $field_label . ' :: ' . $old_value . ' >>> ' . $new_value;
                 } else {
                     $row2 = _('Changed') . ' ' . $field_label . ' :: ' . $old_value . ' >>> ' . $new_value;
                 }
             }
             $do_crm_fields->free();
             break;
     }
     if ($obj->user_avatar != '') {
         $avatar_path = $GLOBALS['AVATAR_DISPLAY_PATH'];
         $thumb = $avatar_path . '/ths_' . $obj->user_avatar . '.' . $obj->file_extension;
     }
     if ($link === true) {
         $detail_url = NavigationControl::getNavigationLink($_SESSION["do_module"]->modules_full_details[$obj->idmodule]["name"], "detail", $obj->id_referrer);
         $row2 .= '&nbsp;<a href="' . $GLOBALS['SITE_URL'] . $detail_url . '">' . $GLOBALS['SITE_URL'] . $detail_url . '</a>';
     }
     $ret_array = array("avatar" => $thumb, "row1" => $row1, "row2" => $row2);
     return $ret_array;
 }
Пример #3
0
    if ($contact_detail[0]['secondary_email'] != '') {
        $secondary_email = $contact_detail[0]['secondary_email'];
    }
    $api = $emailer->get_api_instance();
    $err = '';
    if (false === $email_found) {
        $err = _('No email found to fetch the activity from sendwithus');
    } else {
        if ($primary_email != '') {
            $primary_email_log = $api->get_customer_logs($primary_email);
            $primary_email_log_data = array();
            if ($primary_email_log->success == 1 && count($primary_email_log->logs) > 0) {
                foreach ($primary_email_log->logs as $key => $val) {
                    $primary_email_log_data[] = array('template_name' => $val->email_name, 'status' => $val->status, 'sent_at' => i18nDate::i18n_long_date(date('Y-m-d H:i:s', $val->created), true));
                }
            }
        }
        if ($secondary_email != '') {
            $secondary_email_log = $api->get_customer_logs($secondary_email);
            $secondary_email_log_data = array();
            if ($secondary_email_log->success == 1 && count($secondary_email_log->logs) > 0) {
                foreach ($secondary_email_log as $key => $val) {
                    $secondary_email_log_data[] = array('template_name' => $val->email_name, 'status' => $val->status, 'sent_at' => i18nDate::i18n_long_date(date('Y-m-d H:i:s', $val->created), true));
                }
            }
        }
    }
} else {
    $err = _('Missing contact data to fetch the activity from sendwithus');
}
include_once 'view/deltailview_plugin_view.php';
Пример #4
0
 public static function display_value($value)
 {
     $value = TimeZoneUtil::convert_to_user_timezone($value, true);
     $val = explode(" ", $value);
     $date = parent::display_value($val[0]);
     $time = i18nDate::i18n_time($val[1]);
     return $date . ' ' . $time;
 }
Пример #5
0
 /**
  * function to get the last update of a record
  * @param integer $idrecord
  * @param integer $idmodule
  * @param object $module_object
  * @param array
  */
 public function get_last_updates($idrecord, $idmodule, $module_object)
 {
     $updates = array();
     if ($module_object->last_modified_by > 0) {
         $qry = "\n\t\t\tselect user.firstname, user.lastname , file_uploads.file_extension,user.user_avatar \n\t\t\tfrom user\n\t\t\tleft join file_uploads on user.user_avatar = file_uploads.file_name \n\t\t\twhere user.iduser = ?";
         $stmt = $this->getDbConnection()->executeQuery($qry, array($module_object->last_modified_by));
         if ($stmt->rowCount() > 0) {
             $data = $stmt->fetch();
             $avatar = '';
             if ($data["user_avatar"] != '') {
                 $avatar_path = $GLOBALS['AVATAR_DISPLAY_PATH'];
                 $avatar = $avatar_path . '/ths_' . $data["user_avatar"] . '.' . $data["file_extension"];
             }
             $updates["update"] = array("modified" => i18nDate::i18n_long_date(TimeZoneUtil::convert_to_user_timezone($module_object->last_modified, true), true), "user_name" => $data["firstname"] . ' ' . $data["lastname"], "user_avatar" => $avatar);
         }
     }
     $qry = "\n\t\tselect `data_history`.*, user.firstname, user.lastname , file_uploads.file_extension,user.user_avatar \n\t\tfrom `data_history`\n\t\tinner join `user` on `user`.`iduser` = `data_history`.`iduser`\n\t\tleft join file_uploads on user.user_avatar = file_uploads.file_name \n\t\twhere `data_history`.`idmodule` = ?\n\t\tAND `data_history`.`id_referrer` = ?\n\t\torder by `data_history`.`iddata_history` asc limit 1 ";
     $stmt = $this->getDbConnection()->executeQuery($qry, array($idmodule, $idrecord));
     if ($stmt->rowCount() > 0) {
         $data = $stmt->fetch();
         $avatar = '';
         if ($data["user_avatar"] != '') {
             $avatar_path = $GLOBALS['AVATAR_DISPLAY_PATH'];
             $avatar = $avatar_path . '/ths_' . $data["user_avatar"] . '.' . $data["file_extension"];
         }
         $updates["add"] = array("modified" => i18nDate::i18n_long_date(TimeZoneUtil::convert_to_user_timezone($data["date_modified"], true), true), "user_name" => $data["firstname"] . ' ' . $data["lastname"], "user_avatar" => $avatar);
     }
     return $updates;
 }
Пример #6
0
 /**
  * function to construct the live feed text to display
  * @param object $obj
  * @return array
  */
 public function construct_feed_text($obj)
 {
     $action_user = $obj->firstname . ' ' . $obj->lastname;
     $thumb = '';
     if ($obj->user_avatar != '') {
         $avatar_path = $GLOBALS['AVATAR_DISPLAY_PATH'];
         $thumb = $avatar_path . '/ths_' . $obj->user_avatar . '.' . $obj->file_extension;
     }
     $date_added = i18nDate::i18n_long_date(TimeZoneUtil::convert_to_user_timezone($obj->date_added, true), true);
     $module_name = CommonUtils::get_module_name_as_text($obj->idmodule);
     $link_identifier = true;
     $related_identifer_text = '';
     $link_related_identifier = true;
     $mentions = false;
     switch ($obj->action) {
         case 'add':
             $content = _('Added') . ' ' . $module_name;
             break;
         case 'edit':
             $content = _('Updated') . ' ' . $module_name;
             break;
         case 'delete':
             $content = _('Deleted') . ' ' . $module_name . ' - ';
             $link_identifier = false;
             break;
         case 'lead_covert':
             $content = _('Converted') . ' ' . $module_name;
             break;
         case 'add_contact_lead_convert':
             $content = _('Added') . ' ' . $module_name;
             $related_identifer_text = _('during converting the lead');
             break;
         case 'add_organization_lead_convert':
             $content = _('Added') . ' ' . $module_name;
             $related_identifer_text = _('during converting the lead');
             break;
         case 'add_potential_lead_convert':
             $content = _('Added') . ' ' . $module_name;
             $related_identifer_text = _('during converting the lead');
             break;
         case 'changed_assigned_to':
             $content = _('Changed assigned to ') . ' ' . $module_name;
             break;
         case 'note_mention':
             $content = _('Mentions you in note on ') . ' ' . $module_name;
             $mentions = true;
             break;
     }
     if ($link_identifier === true) {
         if (true === $mentions) {
             $detail_url = NavigationControl::getNavigationLink($_SESSION["do_module"]->modules_full_details[$obj->idmodule]["name"], 'detail', $obj->idrecord, '#note' . $obj->related_identifier_idrecord);
             $identifier = '&nbsp;<a href="' . $GLOBALS['SITE_URL'] . $detail_url . '">' . $obj->identifier . '</a>';
         } else {
             $detail_url = NavigationControl::getNavigationLink($_SESSION["do_module"]->modules_full_details[$obj->idmodule]["name"], "detail", $obj->idrecord);
             $identifier = '&nbsp;<a href="' . $GLOBALS['SITE_URL'] . $detail_url . '">' . $obj->identifier . '</a>';
         }
     } else {
         $identifier = $obj->identifier;
     }
     $content .= ' ' . $identifier;
     if (strlen($related_identifer_text) > 5) {
         if ($link_related_identifier === true) {
             $related_detail_url = NavigationControl::getNavigationLink($_SESSION["do_module"]->modules_full_details[$obj->related_identifier_idmodule]["name"], "detail", $obj->related_identifier_idrecord);
             $related_identifier = '&nbsp;<a href="' . $GLOBALS['SITE_URL'] . $related_detail_url . '">' . $obj->related_identifier . '</a>';
         } else {
             $related_identifier = $obj->related_identifier;
         }
         $content .= ' ' . $related_identifer_text . $related_identifier;
     }
     return array("user_name" => $action_user, "avatar" => $thumb, "content" => $content, "action_date" => $date_added);
 }
Пример #7
0
 /**
  * function to get the complete conversion information
  * @param integer $idleads
  * @return array if data found else false
  */
 public function get_conversion_matrix($idleads)
 {
     $qry = "select * from `leads_conversion_matrix` where `idleads` = ?";
     $this->query($qry, array($idleads));
     if ($this->getNumRows() > 0) {
         $this->next();
         if ((int) $this->idpotentials > 0) {
             $do_potentials = new Potentials();
             $q_p = "\n\t\t\t\tselect `potential_name` \n\t\t\t\tfrom `" . $do_potentials->getTable() . "` \n\t\t\t\twhere `idpotentials` = ?";
             $do_potentials->query($q_p, array($this->idpotentials));
             if ($do_potentials->getNumRows() > 0) {
                 $do_potentials->next();
                 $return_array["potential"] = array("idpotentials" => (int) $this->idpotentials, "potential_name" => $do_potentials->potential_name);
             }
         }
         if ((int) $this->idorganization > 0) {
             $do_organization = new Organization();
             $q_o = "\n\t\t\t\tselect `organization_name` \n\t\t\t\tfrom `" . $do_organization->getTable() . "` \n\t\t\t\twhere `idorganization` = ?";
             $do_organization->query($q_o, array($this->idorganization));
             if ($do_organization->getNumRows() > 0) {
                 $do_organization->next();
                 $return_array["organization"] = array("idorganization" => (int) $this->idorganization, "organization_name" => $do_organization->organization_name);
             }
         }
         if ((int) $this->idcontacts > 0) {
             $do_contacts = new Contacts();
             $q_c = "\n\t\t\t\tselect `firstname`,`lastname` \n\t\t\t\tfrom `" . $do_contacts->getTable() . "` where `idcontacts` = ?";
             $do_contacts->query($q_c, array($this->idcontacts));
             if ($do_contacts->getNumRows() > 0) {
                 $do_contacts->next();
                 $return_array["contact"] = array("idcontacts" => (int) $this->idcontacts, "contact_name" => $do_contacts->firstname . ' ' . $do_contacts->lastname);
             }
         }
         $do_user = new User();
         $do_user->getId((int) $this->iduser);
         $return_array["user"] = array("user_name" => $do_user->user_name, "fullname" => $do_user->firstname . ' ' . $do_user->lastname);
         $return_array["conversion_date"] = array("conversion_date" => i18nDate::i18n_long_date(TimeZoneUtil::convert_to_user_timezone($this->conversion_date, true), true));
         return $return_array;
     } else {
         return false;
     }
 }
Пример #8
0
    /**
     * function to display each note
     * @param object $obj
     */
    function display_note($obj, $active_users)
    {
        $note_documents = '';
        $avatar_path = $GLOBALS['AVATAR_DISPLAY_PATH'];
        $note_by = '';
        if ((int) $obj->iduser > 0) {
            $note_by = $obj->firstname . ' ' . $obj->lastname;
            if ($obj->user_avatar != '') {
                $thumb = '<img src="' . $avatar_path . '/ths_' . $obj->user_avatar . '.' . $obj->file_extension_user_avatar . '" style="width:20px;height:20px;" />';
            } else {
                $thumb = '<span class="add-on"><i class="icon-user"></i></span>';
            }
        } elseif ((int) $obj->idcpanel_user > 0) {
            $note_by = $obj->c_firstname . ' ' . $obj->c_lastname;
            if ($obj->contact_avatar != '') {
                $thumb = '<img src="' . $avatar_path . '/ths_' . $obj->contact_avatar . '.' . $obj->file_extension_contact_avatar . '" style="width:20px;height:20px;" />';
            } else {
                $thumb = '<span class="add-on"><i class="icon-user"></i></span>';
            }
        }
        $note_content = $obj->notes;
        $note_content = \CommonUtils::format_display_text($note_content);
        $note_content = \FieldType200::display_value($note_content);
        $do_files_and_attachment = new \CRMFilesAndAttachments();
        $do_files_and_attachment->get_uploaded_files(8, $obj->idnotes);
        if ($do_files_and_attachment->getNumRows() > 0) {
            $e_download = new Event("CRMFilesAndAttachments->eventDownloadFiles");
            $e_download->setEventControler("/eventcontroler.php");
            $note_documents = '<p>';
            while ($do_files_and_attachment->next()) {
                $e_download->addParam("fileid", $do_files_and_attachment->idfile_uploads);
                $download_link = $e_download->getLink($do_files_and_attachment->file_description);
                $note_documents .= $download_link . '<br />';
            }
            $note_documents .= '</p>';
        }
        $date_added = \i18nDate::i18n_long_date(\TimeZoneUtil::convert_to_user_timezone($obj->date_added, true), true);
        $html = <<<html
\t\t<div class="notes_content" id="note{$obj->idnotes}">{$thumb}
\t\t\t<strong>{$note_by}</strong>
\t\t\t<span class="notes_content_right" style="display:none;">
\t\t\t\t<a href="#" onclick="display_edit_notes('{$obj->idnotes}'); return false;">edit</a> | 
\t\t\t\t<a href="#" onclick="delete_notes('{$obj->idnotes}'); return false;">delete</a>
\t\t\t</span>
\t\t\t<p id="content_{$obj->idnotes}">
\t\t\t\t{$note_content}
\t\t\t</p>
\t\t\t{$note_documents}
\t\t\t<p id="content_hidden_{$obj->idnotes}" style="display:none;"></p>
\t\t\t<a href="#note-content-{$obj->idnotes}" onclick="return false ;" id="note-content-{$obj->idnotes}"><span class="notes_date_added">{$date_added}</span></a>
      </div>
      <hr class="form_hr" id="note_separator_{$obj->idnotes}">
html;
        $do_files_and_attachment->free();
        echo $html;
    }