Exemplo n.º 1
0
function getEditor($fieldtype, $fieldname, $fieldtext, $surveyID = null, $gID = null, $qID = null, $action = null)
{
    global $defaulthtmleditormode;
    if (isset($_SESSION['htmleditormode']) && $_SESSION['htmleditormode'] == 'none') {
        return '';
    }
    if (!isset($_SESSION['htmleditormode']) || $_SESSION['htmleditormode'] != 'inline' && $_SESSION['htmleditormode'] != 'popup') {
        $htmleditormode = $defaulthtmleditormode;
    } else {
        $htmleditormode = $_SESSION['htmleditormode'];
    }
    if (($fieldtype == 'email-inv' || $fieldtype == 'email-reg' || $fieldtype == 'email-conf' || $fieldtype == 'email-rem') && getEmailFormat($surveyID) != 'html') {
        return '';
    }
    if ($htmleditormode == 'popup' || $fieldtype == 'editanswer' || $fieldtype == 'addanswer' || $fieldtype == 'editlabel' || $fieldtype == 'addlabel') {
        return getPopupEditor($fieldtype, $fieldname, $fieldtext, $surveyID, $gID, $qID, $action);
    } elseif ($htmleditormode == 'inline') {
        return getInlineEditor($fieldtype, $fieldname, $fieldtext, $surveyID, $gID, $qID, $action);
    } else {
        return '';
    }
}
Exemplo n.º 2
0
function getEditor($fieldtype, $fieldname, $fieldtext, $surveyID = null, $gID = null, $qID = null, $action = null)
{
    global $defaulthtmleditormode;
    //error_log("TIBO fieldtype=$fieldtype,fieldname=$fieldname,fieldtext=$fieldtext,surveyID=$surveyID,gID=$gID,qID=$qID,action=$action");
    if (isset($_SESSION['htmleditormode']) && $_SESSION['htmleditormode'] == 'none') {
        return '';
    }
    if (!isset($_SESSION['htmleditormode']) || $_SESSION['htmleditormode'] != 'inline' && $_SESSION['htmleditormode'] != 'popup') {
        $htmleditormode = $defaulthtmleditormode;
    } else {
        $htmleditormode = $_SESSION['htmleditormode'];
    }
    if (($fieldtype == 'email-inv' || $fieldtype == 'email-reg' || $fieldtype == 'email-conf' || $fieldtype == 'email-rem') && getEmailFormat($surveyID) != 'html') {
        return '';
    }
    if ($htmleditormode == 'popup' || ($fieldtype == 'editanswer' || $fieldtype == 'addanswer' || $fieldtype == 'editlabel' || $fieldtype == 'addlabel') && preg_match("/^translate/", $action) == 0) {
        return getPopupEditor($fieldtype, $fieldname, $fieldtext, $surveyID, $gID, $qID, $action);
    } elseif ($htmleditormode == 'inline') {
        return getInlineEditor($fieldtype, $fieldname, $fieldtext, $surveyID, $gID, $qID, $action);
    } else {
        return '';
    }
}
Exemplo n.º 3
0
function getEditor($fieldtype, $fieldname, $fieldtext, $surveyID = null, $gID = null, $qID = null, $action = null)
{
    initKcfinder();
    //error_log("TIBO fieldtype=$fieldtype,fieldname=$fieldname,fieldtext=$fieldtext,surveyID=$surveyID,gID=$gID,qID=$qID,action=$action");
    $session =& Yii::app()->session;
    if ($session['htmleditormode'] && $session['htmleditormode'] == 'none') {
        return '';
    }
    if (!$session['htmleditormode'] || $session['htmleditormode'] != 'inline' && $session['htmleditormode'] != 'popup') {
        $htmleditormode = Yii::app()->getConfig('defaulthtmleditormode');
    } else {
        $htmleditormode = $session['htmleditormode'];
    }
    if ($surveyID && getEmailFormat($surveyID) != 'html' && substr($fieldtype, 0, 6) === "email-") {
        return '';
    }
    if ($htmleditormode == 'popup' || ($fieldtype == 'editanswer' || $fieldtype == 'addanswer' || $fieldtype == 'editlabel' || $fieldtype == 'addlabel') && preg_match("/^translate/", $action) == 0) {
        return getPopupEditor($fieldtype, $fieldname, $fieldtext, $surveyID, $gID, $qID, $action);
    } elseif ($htmleditormode == 'inline') {
        return getInlineEditor($fieldtype, $fieldname, $fieldtext, $surveyID, $gID, $qID, $action);
    } else {
        return '';
    }
}
/**
 * displayTranslateFields() Formats and displays translation fields (base language as well as to language)
 * @global $dbprefix, $clang;
 * @param string $surveyid Survey id
 * @param string $gid Group id
 * @param string $qid Question id
 * @param string $type Type of database field that is being translated, e.g. title, question, etc.
 * @param array $amTypeOptions Array containing options associated with each $type
 * @param string $baselangdesc The source translation language, e.g. "English"
 * @param string $tolangdesc The target translation language, e.g. "German"
 * @param string $textfrom The text to be translated in source language
 * @param string $textto The text to be translated in target language
 * @param integer $i Counter
 * @param string $rowfrom Contains current row of database query
 * @param boolean $evenRow True for even rows, false for odd rows
 * @return string $translateoutput
 */
function displayTranslateFields($surveyid, $gid, $qid, $type, $amTypeOptions, $baselangdesc, $tolangdesc, $textfrom, $textto, $i, $rowfrom, $evenRow)
{
    $translateoutput = "";
    if ($evenRow) {
        $translateoutput .= "<tr class=\"odd\">";
    } else {
        $translateoutput .= "<tr class=\"even\">";
    }
    $value1 = "";
    if ($amTypeOptions["id1"] != "") {
        $value1 = $rowfrom[$amTypeOptions["id1"]];
    }
    $value2 = "";
    if ($amTypeOptions["id2"] != "") {
        $value2 = $rowfrom[$amTypeOptions["id2"]];
    }
    // Display text in original language
    // Display text in foreign language. Save a copy in type_oldvalue_i to identify changes before db update
    $translateoutput .= "" . "<td class='_from_' id='{$type}_from_{$i}'>{$textfrom}</td>\n" . "<td>\n";
    $translateoutput .= "<input type='hidden' name='{$type}_id1_{$i}' value='{$value1}' />\n";
    $translateoutput .= "<input type='hidden' name='{$type}_id2_{$i}' value='{$value2}' />\n";
    $nrows = max(calc_nrows($textfrom), calc_nrows($textto));
    $translateoutput .= "<input type='hidden' " . "name='" . $type . "_oldvalue_" . $i . "' " . "value='" . htmlspecialchars($textto, ENT_QUOTES) . "' />\n";
    $translateoutput .= "<textarea cols='80' rows='" . $nrows . "' " . " name='{$type}_newvalue_{$i}' >" . htmlspecialchars($textto) . "</textarea>\n";
    if ($amTypeOptions["HTMLeditorDisplay"] == "Inline") {
        $translateoutput .= "" . getEditor("edit" . $type, $type . "_newvalue_" . $i, htmlspecialchars($textto), $surveyid, $gid, $qid, "translate" . $amTypeOptions["HTMLeditorType"]);
    }
    if ($amTypeOptions["HTMLeditorDisplay"] == "Popup") {
        $translateoutput .= "" . getPopupEditor("edit" . $type, $type . "_newvalue_" . $i, urlencode($amTypeOptions['description']), $surveyid, $gid, $qid, "translate" . $amTypeOptions["HTMLeditorType"]);
    }
    $translateoutput .= "\n</td>\n" . "</tr>\n";
    return $translateoutput;
}