コード例 #1
0
 public function Footer()
 {
     $this->setY(-12);
     $this->SetFont('freesans', '', 6, '', true);
     $this->Cell(0, 3, mb_strtoupper(api_text("module-diary_export-page"), 'UTF-8') . " " . $this->getAliasNumPage() . " " . mb_strtoupper(api_text("module-diary_export-pageOf"), 'UTF-8') . " " . $this->getAliasNbPages(), 0, 0, 'L', 0);
     $this->Cell(0, 3, mb_strtoupper(api_text("module-diary_export-footer"), 'UTF-8') . " " . $training->datetraining, 0, 0, 'R', 0);
     //$this->Cell(0,3,mb_strtoupper(api_text("module-diary_export-footer"),'UTF-8')." ".$GLOBALS['module-diary']->number,0,0,'R',0);
 }
コード例 #2
0
function content()
{
    // acquire variables
    $g_search = $_GET['q'];
    // show filters
    echo $GLOBALS['navigation']->filtersText();
    // build table
    $trainings_table = new str_table(api_text("module-diary_list-tr-unvalued"), TRUE, $GLOBALS['navigation']->filtersGet());
    $trainings_table->addHeader(" ", NULL, "16");
    $trainings_table->addHeader(api_text("module-diary_list-th-sport"), "nowarp", NULL, "`module-diary_trainings`.`sport`");
    $trainings_table->addHeader(api_text("module-diary_list-th-sort"), "nowarp", NULL, "`module-diary_trainings`.`sort`");
    $trainings_table->addHeader(api_text("module-diary_list-th-time"), "nowarp", NULL, "`module-diary_trainings`.`time`");
    $trainings_table->addHeader(api_text("module-diary_list-th-distance"), "nowarp", NULL, "`module-diary_trainings`.`distance`");
    $trainings_table->addHeader(api_text("module-diary_list-th-datetraining"), "nowarp", NULL, "`module-diary_trainings`.`datetraining`");
    $trainings_table->addHeader(api_text("module-diary_list-th-description"), NULL, "40%");
    // get trainings
    $trainings = api_moduleDiary_trainings($g_search, TRUE);
    foreach ($trainings->results as $training) {
        // check selected
        if ($training->id == $_GET['idTraining']) {
            $tr_class = "info";
        } else {
            $tr_class = NULL;
        }
        // build address table row
        $trainings_table->addRow($tr_class);
        // build table fields
        $trainings_table->addField(api_link("module-diary_view.php?idTraining=" . $training->id, api_icon("icon-search", api_text("module-diary_list-td-view"))), "nowarp");
        $trainings_table->addField($training->sportText, "nowarp");
        $trainings_table->addField($training->sortText, "nowarp");
        $trainings_table->addField($training->time, "nowarp");
        $trainings_table->addField($training->distance, "nowarp");
        /**
        * Timestamp Format
        * @param string $timestamp MySql datetime
        * @param string $format datetime format ( php date format or language key )
        * @param string $language language conversion
        * @return string formatted date time
        */
        //function api_timestampFormat($timestamp,$format="Y-m-d H:i:s",$language=NULL){
        //$trainings_table->addField(api_timestampFormat($training->datetraining,"D-d-M-y"));
        $training->datetraining = strtotime($training->datetraining);
        $giorno = date('D-d-M-y', $training->datetraining);
        $trainings_table->addField($giorno);
        //$trainings_table->addField($training->datetraining);
        $trainings_table->addField($training->description, "nowarp");
    }
    // show table
    $trainings_table->render();
    // renderize the pagination
    $trainings->pagination->render();
    // debug
    if ($_SESSION["account"]->debug) {
        pre_var_dump($trainings->query, "print", "query");
        pre_var_dump($trainings->results, "print", "trainings");
    }
}
コード例 #3
0
function content()
{
    // get object
    $training = api_moduleDiary_training($_GET['idTraining']);
    //build training form
    $training_form = new str_form("submit.php?act=training_save&idTraining=" . $training->id, "post", "training_edit");
    $training_form->addField("radio", "sport", api_text("module-diary_edit-ff-sport"), NULL, "inline");
    $training_form->addFieldOption("R", api_text("module-diary_edit-fo-sport-run"), !$training->id || "R" == $training->sport ? TRUE : FALSE);
    $training_form->addFieldOption("S", api_text("module-diary_edit-fo-sport-swim"), "S" == $training->sport ? TRUE : FALSE);
    $training_form->addFieldOption("B", api_text("module-diary_edit-fo-sport-bike"), "B" == $training->sport ? TRUE : FALSE);
    $training_form->addFieldOption("T", api_text("module-diary_edit-fo-sport-trail"), "T" == $training->sport ? TRUE : FALSE);
    $training_form->addFieldOption("W", api_text("module-diary_edit-fo-sport-snowshoes"), "W" == $training->sport ? TRUE : FALSE);
    $training_form->addFieldOption("N", api_text("module-diary_edit-fo-sport-rest"), "N" == $training->sport ? TRUE : FALSE);
    $training_form->addField("radio", "sort", api_text("module-diary_edit-ff-sort"), NULL, "inline");
    $training_form->addFieldOption("S", api_text("module-diary_edit-fo-sort-slow"), !$training->id || "S" == $training->sort ? TRUE : FALSE);
    $training_form->addFieldOption("L", api_text("module-diary_edit-fo-sort-long"), "L" == $training->sport ? TRUE : FALSE);
    $training_form->addFieldOption("F", api_text("module-diary_edit-fo-sort-fast"), "F" == $training->sport ? TRUE : FALSE);
    $training_form->addFieldOption("N", api_text("module-diary_edit-fo-sort-rest"), "N" == $training->sport ? TRUE : FALSE);
    $training_form->addField("text", "time", api_text("module-diary_edit-ff-time"), $training->time, "input-medium", api_text("module-diary_edit-ff-time-placeholder"));
    $training_form->addField("text", "distance", api_text("module-diary_edit-ff-distance"), $training->distance, "input-small", api_text("module-diary_edit-ff-distance-placeholder"));
    $training_form->addField("text", "description", api_text("module-diary_edit-ff-description"), $training->description, "input-large", api_text("module-diary_edit-ff-description-placeholder"));
    $training_form->addField("date", "datetraining", api_text("module-diary_edit-ff-datetraining"), $training->datetraining, "input-small");
    // controls
    $training_form->addControl("submit", api_text("module-diary_edit-fc-submit"));
    if ($training->id) {
        $training_form->addControl("button", api_text("module-diary_edit-fc-cancel"), NULL, "module-training_view.php?idTraining=" . $training->id);
    } else {
        $training_form->addControl("button", api_text("module-diary_edit-fc-cancel"), NULL, "module-training_list.php");
    }
    // show training form
    $training_form->render();
    // debug
    if ($_SESSION["account"]->debug) {
        pre_var_dump($training, "print", "training");
    }
    ?>
<script type="text/javascript">
 $(document).ready(function(){
  // validation
  $("form[name='training_edit']").validate({
   rules:{
    sport:{required:true,minlength:1},
    sort:{required:true,minlength:1}
   },
   submitHandler:function(form){form.submit();}
  });
 });
</script>
<?php 
}
コード例 #4
0
ファイル: api.inc.php プロジェクト: masKratter/module-diary
/**
 * Ssort text
 *
 * @param mixed $training training object
 * @return string sort text
 */
function api_moduleDiary_sortText($training)
{
    switch ($training->sort) {
        case "S":
            $return = api_text("sort-slow");
            break;
        case "L":
            $return = api_text("sort-long");
            break;
        case "F":
            $return = api_text("sort-fast");
            break;
        case "N":
            $return = api_text("sort-rest");
            break;
        default:
            $return = "[Sort not found]";
    }
    return $return;
}
コード例 #5
0
function content()
{
    // get objects
    $training = api_moduleDiary_training($_GET['idTraining']);
    if (!$training->id) {
        echo api_text("trainingNotFound");
        return FALSE;
    }
    // build training dynamic list
    $training_dl = new str_dl("br", "dl-horizontal");
    $training_dl->addElement(api_text("module-diary_view-dt-sport"), $training->sportText);
    $training_dl->addElement(api_text("module-diary_view-dt-sort"), $training->sortText);
    $training_dl->addElement(api_text("module-diary_view-dt-time"), $training->time);
    $training_dl->addElement(api_text("module-diary_view-dt-distance"), $training->distance);
    $training_dl->addElement(api_text("module-diary_view-dt-description"), $training->description);
    $training_dl->addElement(api_text("module-diary_view-dt-datetraining"), $training->datetraining);
    // show address dynamic list
    $training_dl->render();
    // debug
    if ($_SESSION["account"]->debug) {
        pre_var_dump($training, "print", "training");
    }
}
コード例 #6
0
    if ($_GET['resetFilters'] || $_GET['filtered'] != 1 && $_SESSION['filters'][api_baseName()]['filtered'] != 1) {
        //include("filters.inc.php");
    }
}
// list
$navigation->addTab(api_text("module-diary-nav-list"), "module-diary_list.php");
if (api_baseName() == "module-diary_list.php") {
    $navigation->addSubTab(api_text("module-diary-nav-export_list"), "module-diary_export_list.php");
}
// operations
if ($training->id) {
    $navigation->addTab(api_text("module-diary-nav-operations"), NULL, NULL, "active");
    $navigation->addSubTab(api_text("module-diary-nav-edit"), "module-diary_edit.php?idTraining=" . $training->id, NULL, NULL, api_checkPermission($module_name, "training_edit") ? TRUE : FALSE);
    $navigation->addSubTab(api_text("module-diary-nav-delete"), "submit.php?act=training_delete&idTraining=" . $training->id, NULL, NULL, api_checkPermission($module_name, "training_del") ? TRUE : FALSE, "_self", api_text("module-diary-nav-delete-confirm"));
    $navigation->addSubTab(api_text("module-diary-nav-export"), "module-diary_export.php?idTraining=" . $training->id);
} else {
    // add new, with check permission
    $navigation->addTab(api_text("module-diary-nav-add"), "module-diary_edit.php", NULL, NULL, api_checkPermission($module_name, "training_dit") ? TRUE : FALSE);
}
// show navigation menu
$navigation->render();
// check permissions before displaying module
if ($checkPermission == NULL) {
    content();
} else {
    if (api_checkPermission($module_name, $checkPermission, TRUE)) {
        content();
    }
}
// print footer
$html->footer();
コード例 #7
0
<?php

/* -------------------------------------------------------------------------- *\
|* -[ World - Chained Districts JSON ]--------------------------------------- *|
\* -------------------------------------------------------------------------- */
require_once "../core/api.inc.php";
require_once "api.inc.php";
// definitions
$results = array();
// acquire variables
$undefined = $_GET['undefined'];
$idRegion = $_GET['idRegion'];
// add default results
if ($undefined != "FALSE") {
    $results[''] = ucfirst(api_text("undefined"));
}
// build query where
$query_where = " idRegion='" . $idRegion . "'";
// check query
//if(!$GLOBALS['db']->countOf("world_regions",$query_where)){$query_where=" 1";}
// execute the query
$districts = $GLOBALS['db']->query("SELECT * FROM world_districts WHERE" . $query_where . " ORDER BY name ASC");
while ($district = $GLOBALS['db']->fetchNextObject($districts)) {
    $results[$district->id] = api_world_district($district)->name;
}
// encode the results
echo json_encode($results);