Passed
Push — scrutinizer-code-quality ( 09f5a1...c4c5fb )
by Adam
56:05 queued 14:08
created

AOK_KnowledgeBaseViewEdit::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2
Metric Value
cc 1
eloc 2
nc 1
nop 0
dl 0
loc 4
ccs 0
cts 4
cp 0
crap 2
rs 10
1
<?php
2
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
3
/*********************************************************************************
4
 * SugarCRM Community Edition is a customer relationship management program developed by
5
 * SugarCRM, Inc. Copyright (C) 2004-2013 SugarCRM Inc.
6
7
 * SuiteCRM is an extension to SugarCRM Community Edition developed by Salesagility Ltd.
8
 * Copyright (C) 2011 - 2014 Salesagility Ltd.
9
 *
10
 * This program is free software; you can redistribute it and/or modify it under
11
 * the terms of the GNU Affero General Public License version 3 as published by the
12
 * Free Software Foundation with the addition of the following permission added
13
 * to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
14
 * IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
15
 * OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
16
 *
17
 * This program is distributed in the hope that it will be useful, but WITHOUT
18
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
19
 * FOR A PARTICULAR PURPOSE.  See the GNU Affero General Public License for more
20
 * details.
21
 *
22
 * You should have received a copy of the GNU Affero General Public License along with
23
 * this program; if not, see http://www.gnu.org/licenses or write to the Free
24
 * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
25
 * 02110-1301 USA.
26
 *
27
 * You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
28
 * SW2-130, Cupertino, CA 95014, USA. or at email address [email protected].
29
 *
30
 * The interactive user interfaces in modified source and object code versions
31
 * of this program must display Appropriate Legal Notices, as required under
32
 * Section 5 of the GNU Affero General Public License version 3.
33
 *
34
 * In accordance with Section 7(b) of the GNU Affero General Public License version 3,
35
 * these Appropriate Legal Notices must retain the display of the "Powered by
36
 * SugarCRM" logo and "Supercharged by SuiteCRM" logo. If the display of the logos is not
37
 * reasonably feasible for  technical reasons, the Appropriate Legal Notices must
38
 * display the words  "Powered by SugarCRM" and "Supercharged by SuiteCRM".
39
 ********************************************************************************/
40
41
require_once('include/MVC/View/views/view.edit.php');
42
43
class AOK_KnowledgeBaseViewEdit extends ViewEdit
44
{
45
    function __construct()
46
    {
47
        parent::__construct();
48
    }
49
50
    /**
51
     * @deprecated deprecated since version 7.6, PHP4 Style Constructors are deprecated and will be remove in 7.8, please update your code, use __construct instead
52
     */
53
    function AOK_KnowledgeBaseViewEdit(){
54
        $deprecatedMessage = 'PHP4 Style Constructors are deprecated and will be remove in 7.8, please update your code';
55
        if(isset($GLOBALS['log'])) {
56
            $GLOBALS['log']->deprecated($deprecatedMessage);
57
        }
58
        else {
59
            trigger_error($deprecatedMessage, E_USER_DEPRECATED);
60
        }
61
        self::__construct();
62
    }
63
64
65
	public function preDisplay() {
66
		global $current_user;
67
		parent::preDisplay();
68
		$this->bean->author = $current_user->name;
69
		$this->bean->user_id_c = $current_user->id;
70
	}
71
72
	function display()
73
    {
74
        parent::display();
75
        $this->displayTMCE();
76
    }
77
78
79
    function displayTMCE(){
80
        require_once("include/SugarTinyMCE.php");
81
        global $locale;
82
83
        $tiny = new SugarTinyMCE();
84
        $tinyMCE = $tiny->getConfig();
85
86
        $js =<<<JS
87
		<script language="javascript" type="text/javascript">
88
		$tinyMCE
89
		var df = '{$locale->getPrecedentPreference('default_date_format')}';
90
91
 		tinyMCE.init({
92
    		theme : "advanced",
93
    		theme_advanced_toolbar_align : "left",
94
    		mode: "exact",
95
			elements : "description",
96
			theme_advanced_toolbar_location : "top",
97
			theme_advanced_buttons1: "code,help,separator,bold,italic,underline,strikethrough,separator,justifyleft,justifycenter,justifyright,justifyfull,separator,forecolor,backcolor,separator,styleprops,styleselect,formatselect,fontselect,fontsizeselect",
98
			theme_advanced_buttons2: "cut,copy,paste,pastetext,pasteword,selectall,separator,search,replace,separator,bullist,numlist,separator,outdent,indent,separator,ltr,rtl,separator,undo,redo,separator, link,unlink,anchor,separator,sub,sup,separator,charmap,visualaid",
99
			theme_advanced_buttons3: "tablecontrols,separator,advhr,hr,removeformat,separator,insertdate,pagebreak",
100
			theme_advanced_fonts:"Andale Mono=andale mono,times;Arial=arial,helvetica,sans-serif;Arial Black=arial black,avant garde;Book Antiqua=book antiqua,palatino;Comic Sans MS=comic sans ms,sans-serif;Courier New=courier new,courier;Georgia=georgia,palatino;Helvetica=helvetica;Helvetica Neu=helveticaneue,sans-serif;Impact=impact,chicago;Symbol=symbol;Tahoma=tahoma,arial,helvetica,sans-serif;Terminal=terminal,monaco;Times New Roman=times new roman,times;Trebuchet MS=trebuchet ms,geneva;Verdana=verdana,geneva;Webdings=webdings;Wingdings=wingdings,zapf dingbats",
101
			plugins : "advhr,insertdatetime,table,paste,searchreplace,directionality,style,pagebreak",
102
			height:"auto",
103
			width: "auto",
104
			inline_styles : true,
105
			directionality : "ltr",
106
			remove_redundant_brs : true,
107
			entity_encoding: 'raw',
108
			cleanup_on_startup : true,
109
			strict_loading_mode : true,
110
			convert_urls : false,
111
			plugin_insertdate_dateFormat : '{DATE '+df+'}',
112
			pagebreak_separator : "<pagebreak />",
113
			extended_valid_elements : "textblock",
114
			custom_elements: "textblock",
115
		});
116
		</script>
117
118
JS;
119
        echo $js;
120
    }
121
122
123
}