Example #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 '';
    }
}
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 '';
    }
}
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 '';
    }
}