コード例 #1
0
ファイル: 02_Ajax.php プロジェクト: rizub4u/gpEasy-CMS
 function Example_Ajax()
 {
     global $page, $addonRelativeCode;
     //prepare the page
     $page->head_js[] = $addonRelativeCode . 'static/02_script.js';
     $page->admin_js = true;
     //get request parameters and execute any commands
     $string = '';
     if (isset($_REQUEST['string'])) {
         $string = $_REQUEST['string'];
     }
     $cmd = common::GetCommand();
     switch ($cmd) {
         case 'randomstring':
             $string = common::RandomString(10);
             break;
     }
     //display the form
     echo '<h2>Example Ajax Requests</h2>';
     echo '<form method="post" action="' . $page->title . '">';
     echo 'Text: <input type="text" name="string" value="' . htmlspecialchars($string) . '" size="30" />';
     echo ' <input type="submit" class="gpajax" value="Post Form Asynchronosly" /> ';
     echo common::Link($page->title, 'Get Random String', 'cmd=randomstring', 'name="gpajax"');
     echo '</form>';
     //output the $_REQUEST variable
     echo '<h3>Request</h3>';
     echo showArray($_REQUEST);
     //plugin example navigation
     gpPlugin::incl('navigation.php');
     PluginExampleNavigation();
 }
コード例 #2
0
ファイル: BA_FEA.php プロジェクト: lightbringer1991/Projects
$elist = array(1, 2, 3, 4);
$ne = sizeof($elist);
echo "Number of elements: {$ne}";
echo "\n";
$etype = 'Euler-Bernoulli';
// Timoshenko
$nodes_e = 2;
$ndofs_n = 2;
$ndofs_e = $ndofs_n * $nodes_e;
$ndofs_all = ($ne + 1) * $ndofs_n;
$K = array();
for ($i = 0; $i < $ndofs_all; $i++) {
    $K[$i] = array_fill(0, $ndofs_all, 0);
}
for ($ie = 0; $ie < $ne; $ie++) {
    $k_e = get_k_e($etype, $E, $I, $le);
    for ($irow = 0; $irow < 4; $irow++) {
        $irow_g = $ie * 2 + $irow;
        for ($icol = 0; $icol < 4; $icol++) {
            $icol_g = $ie * 2 + $icol;
            //			alert("ie: " + ie + ", irow: " + irow + ", icol: " + icol + ", irow_g: " + irow_g + ", icol_g: " + icol_g);
            $K[$irow_g][$icol_g] = $K[$irow_g][$icol_g] + $k_e[$irow][$icol];
        }
    }
}
echo "\n";
echo "Size of K: " . sizeof($K);
echo "\nK = \n\n";
// var_dump($K);
showArray($K, count($K), count($K[0]));
コード例 #3
0
//K(:,xv)=[];
$F = removeRow($F, $xv);
//F(xv)=[];% apply the homogeneous GBCs
echo "\nF 2 = \n\n";
showArray($F, count($F));
$w0 = LUPsolve($K, $F);
//w0=K\F; % nodal displacements
$w1 = array_fill(0, $ndof, 0);
//w1=zeros(ndof,1);
$xv1 = array_fill(0, $ndof, 0);
//xv1=[1:ndof];
for ($i = 0; $i < $ndof; $i++) {
    $xv1[$i] = $i;
}
$xv1 = removeRow($xv1, $xv);
//xv1(xv)=[];
$w1 = replaceVec($w1, $xv1, $w0);
//w1(xv1)=w0; % add the GBCs back
echo "\nw1 = \n\n";
showArray($w1, $ndof);
// %(4) exact solution
// xi=[0:L/99:L]';
// w4=0.01*xi.^5-(1/30)*xi.^3+(7/300)*xi;
$c = 99;
for ($i = 0; $i <= $c; $i++) {
    $xi = $i * $L / $c;
    $w4[$i] = 0.01 * pow($xi, 5) - 1 / 30 * pow($xi, 3) + 7 / 300 * $xi;
}
echo "\nw4 = \n\n";
showArray($w4, $c + 1);
コード例 #4
0
ファイル: sessions.php プロジェクト: rizub4u/gpEasy-CMS
 /**
  * Save UI values for the current user
  *
  */
 function SaveGPUI()
 {
     global $gpAdmin;
     gpsession::SetGPUI();
     includeFile('tool/ajax.php');
     //send response so an error is not thrown
     echo gpAjax::Callback($_REQUEST['jsoncallback']) . '([]);';
     die;
     //for debugging
     die('debug: ' . showArray($_POST) . 'result: ' . showArray($gpAdmin));
 }
コード例 #5
0
/*
	$read_client = new SoapClient($read_wsdl_loc);
    $function_list = $read_client->__getFunctions();
*/
$html = showHTMLHeader();
switch ($_GET['action']) {
    case 'getinformation':
        // $result_array = $read_client->getInformation($session_id, $_GET['id'], "de");
        include 'getinfo.php';
        $result_array = getInformation($session_id, $_GET['id'], "de");
        // $result_array->subtree = initArray();
        /*
        			$html .= showInformationHeader($result_array);
        			$aItem = 0;
        			$html .= showObjectsData($result_array->informationBlocks[$aItem]->data, $aItem);
        */
        $aLevelBackground = array(array("#afa8a3", "#bab4af", "#c6c2bd", "#d7d4d1", "#ddd8d8"), array("#be9994", "#c7a6a2", "#d0b5b2", "#dfccca", "#e3d3d1"), array("#a0a4ac", "#bec2c8", "#d8d8df", "#e6e8eb", "#f0f1f2", "#f6f6f7"), array("#888d95", "#a8acb3", "#c4c7cb", "#d3d5d8"));
        $gLevelBackground = $aLevelBackground[2];
        $gCounter = 0;
        $aNodeLevel = 0;
        $html .= showsubtree($result_array->subtree, $aNodeLevel);
        break;
    default:
        $result_array = $read_client->find($session_id, $clauses, $sort_order, $limit, $lang);
        $html .= showAccordionObject($result_array);
        $html .= showObject($result_array);
}
$html .= showHTMLFooter();
echo $html;
$result = showArray($result_array->subtree);
コード例 #6
0
ファイル: common.php プロジェクト: rizub4u/gpEasy-CMS
/**
 * Error Handling
 * Display the error and a debug_backtrace if gpdebug is not false
 * If gpdebug is an email address, send the error message to the address
 *
 */
function showError($errno, $errmsg, $filename, $linenum, $vars)
{
    global $wbErrorBuffer, $addon_current_id, $page, $addon_current_version;
    // since we're supporting php 4.3+ there are technically a lot on non-static functions being called statically
    if ($errno === E_STRICT) {
        return;
    }
    // for functions prepended with @ symbol to suppress errors
    if (gpdebug === false && error_reporting() === 0) {
        return;
    }
    //get the backtrace and function where the error was thrown
    $backtrace = array();
    $function = false;
    if (function_exists('debug_backtrace')) {
        $backtrace = debug_backtrace();
        //remove showError() from backtrace
        if (strtolower($backtrace[0]['function']) == 'showerror') {
            @array_shift($backtrace);
        }
    }
    if (gpdebug === false) {
        if (!isset($backtrace[0]['function'])) {
            return;
        }
        $function = $backtrace[0]['function'];
        //try to only record one error per function and only record the error once per request
        $uniq = $filename . $function;
        if (isset($wbErrorBuffer[$uniq])) {
            return;
        }
        //if it's an addon error, determine if if was installed remotely
        if (isset($addon_current_id) && $addon_current_id) {
            $remote_install = false;
            foreach ($backtrace as $row) {
                if (strpos($row['file'], '/data/') !== false) {
                    $remote_install = true;
                    break;
                }
            }
            if (!$remote_install) {
                return;
            }
            //if it's a core error, it should be in the include folder
        } elseif (strpos($backtrace[0]['file'], '/include/') === false) {
            return;
        }
        //record the error
        $i = count($wbErrorBuffer);
        $args['en' . $i] = $errno;
        $args['el' . $i] = $linenum;
        $args['em' . $i] = substr($errmsg, 0, 255);
        $args['ef' . $i] = $filename;
        //filename length checked later
        if (isset($addon_current_id)) {
            $args['ea' . $i] = $addon_current_id;
        }
        if (isset($addon_current_version) && $addon_current_version) {
            $args['ev' . $i] = $addon_current_version;
        }
        if (is_object($page) && !empty($page->title)) {
            $args['ep' . $i] = $page->title;
        }
        $wbErrorBuffer[$uniq] = $args;
        return;
    }
    $errortype = array(E_ERROR => 'Error', E_WARNING => 'Warning', E_PARSE => 'Parsing Error', E_NOTICE => 'Notice', E_CORE_ERROR => 'Core Error', E_CORE_WARNING => 'Core Warning', E_COMPILE_ERROR => 'Compile Error', E_COMPILE_WARNING => 'Compile Warning', E_USER_ERROR => 'User Error', E_USER_WARNING => 'User Warning', E_USER_NOTICE => 'User Notice', E_STRICT => 'Runtime Notice', E_RECOVERABLE_ERROR => 'Recoverable Error', E_DEPRECATED => 'Deprecated', E_USER_DEPRECATED => 'User Deprecated');
    $mess = '';
    $mess .= '<fieldset style="padding:1em">';
    $mess .= '<legend>' . $errortype[$errno] . ' (' . $errno . ')</legend> ' . $errmsg;
    $mess .= '<br/> &nbsp; &nbsp; <b>in:</b> ' . $filename;
    $mess .= '<br/> &nbsp; &nbsp; <b>on line:</b> ' . $linenum;
    if (isset($_SERVER['REQUEST_URI'])) {
        $mess .= '<br/> &nbsp; &nbsp; <b>Request:</b> ' . $_SERVER['REQUEST_URI'];
    }
    if (isset($_SERVER['REQUEST_METHOD'])) {
        $mess .= '<br/> &nbsp; &nbsp; <b>Method:</b> ' . $_SERVER['REQUEST_METHOD'];
    }
    //mysql.. for some addons
    if (function_exists('mysql_errno') && mysql_errno()) {
        $mess .= '<br/> &nbsp; &nbsp; Mysql Error (' . mysql_errno() . ')' . mysql_error();
    }
    //backtrace
    if ($errno !== E_NOTICE && $errno != E_STRICT && function_exists('debug_backtrace')) {
        $mess .= '<div><a href="javascript:void(0)" onclick="this.nextSibling.style.display=\'block\';;return false;">Show Backtrace</a>';
        $mess .= '<div class="nodisplay">';
        $mess .= showArray($backtrace);
        $mess .= '</div></div>';
    }
    $mess .= '</p></fieldset>';
    if (gpdebug === true) {
        message($mess);
    } else {
        global $gp_mailer;
        includeFile('tool/email_mailer.php');
        $gp_mailer->SendEmail(gpdebug, 'debug ', $mess);
    }
}
コード例 #7
0
ファイル: view.php プロジェクト: janwillemm/sa-matcher
    <p>
        <?php 
echo $model->requirements;
?>
    </p>

    <?php 
echo showProperty("Hours per week", $model->hours_per_week);
?>

    <?php 
echo showArray("Periods", \yii\helpers\ArrayHelper::map($model->getPeriodTypes()->all(), 'id', 'duration'));
?>

    <?php 
echo showArray("Type work", \yii\helpers\ArrayHelper::map($model->getWorkTypes()->all(), 'id', 'type'));
?>

    <?php 
echo showEmployees($model->getOwners()->all());
?>


</div>

<?php 
function showProperty($descriptor, $value)
{
    return "<h4>{$descriptor} </h4><p>{$value}</p>";
}
function showArray($descriptor, $array)