//if there are any problems, note the error and carry on looking.
                     add_error("No action can be taken as incomplete information was provided.");
                 }
             }
         }
         //$values = filter_input(INPUT_POST, 'value', FILTER_CALLBACK, array('options'=>'validate_value', 'flags'=>FILTER_REQUIRE_SCALAR) );
     }
     //if all is good, delete the values marked for deletion, then update the other values
     if (!has_error()) {
         foreach ($deletes as $key => $value) {
             $meta_value = MetaDataValue::get($key);
             $meta_value->delete();
         }
         foreach ($updates as $key => $update) {
             $update['effective_date'] = fmt_date($update['effective_date']);
             $update['expiry_date'] = fmt_date($update['expiry_date']);
             $meta_value = MetaDataValue::get($key);
             $meta_value->update($update);
         }
     }
     if (!has_error()) {
         echo "<h2>" . $category->getLabel() . "</h2>";
         echo "<div class=\"content-small\">for " . $organisation->getTitle() . " &gt; " . ucwords($group) . " &gt; " . ucwords($opts["associated_role"]) . "</div><br />";
         echo editMetaDataTable_Category($organisation_id, $group, $role, null, $category);
     } else {
         //if there were any errors, return a 500 and display errors
         header("HTTP/1.0 500 Internal Error");
         echo display_status_messages(false);
     }
     break;
 case 'new_value':
Esempio n. 2
0
<?php

/*
 * Spit out a timesheet for  a given client
 */
require_once 'lib/siteconfig.php';
$debug = g($_GET, 'debug') == 'on';
$from = date('Y-m-01', time());
$to = date('Y-m-d', time());
$month = date('F Y', time());
$target = g($_GET, 'client');
foreach (all_customers() as $c) {
    if ($target && $target != $c['name']) {
        continue;
    }
    $client = fb_client_by_email($c['client_email']);
    $entries = fb_time_entries_by_client($client, array('filter' => array('date_from' => $from, 'date_to' => $to)));
    if (!$entries) {
        continue;
    }
    $html = snippet('emails/digest', array('customer' => $c, 'entries' => $entries, 'client' => $client, 'from' => $from, 'to' => $to));
    $subject = "[Ideas2Executables] Hours Summary for {$month} as of " . fmt_date($to);
    if ($debug) {
        var_dump(array('to' => $c['to'], 'subject' => $subject, 'body' => $html));
    } else {
        xmail($c['to'], $subject, $html);
    }
}
Esempio n. 3
0
<?php

/*
 * A PHP file for rendering our hourly detail
 */
?>
<table width='100%' style='border-collapse: collapse'>
  <?php 
echo snippet('emails/layout/th', array('cols' => A("Date", "Duration", "Notes")));
?>

  <?php 
foreach ($entries as $e) {
    ?>
    <?php 
    echo snippet('emails/layout/td', array('cols' => A(fmt_date($e['date']), fmt_hours($e['hours']), $e['notes']), 'nbsp' => A(0, 1)));
    ?>
  <?php 
}
?>
  <?php 
if (empty($entries)) {
    ?>
    <tr>
      <td colspan="3">No activity yet for <?php 
    echo $month;
    ?>
</td>
    </tr> 
  <?php 
}
Esempio n. 4
0
    function Show()
    {
        global $user;
        if (!$this->allow(ALLOW_SELECT)) {
            return $this->AD();
        }
        $ret = '
		<link rel="stylesheet" type="text/css" href="css/table.css" />
		';
        # Таблица со списком файлов дампа
        $d = @dir(DIR);
        if ($d) {
            while ($entry = $d->read()) {
                if ($entry != '.' && $entry != '..' && is_file(DIR . '/' . $entry) && $entry[0] != '.') {
                    $files[] = $entry;
                }
            }
            if (!empty($files)) {
                sort($files);
            }
            $ret .= "\n\t\t\t<h5>" . $this->str('filelist') . "</h5>\n\t\t\t<table cellpadding=3 cellspacing=1 class=framed width=100%>\n\t\t\t<tr class=thead>\n\t\t\t<td class=thead align=center>#</td>\n\t\t\t<td class=thead align=center>" . $this->str('import_head') . "</td>\n\t\t\t<td class=thead>" . $this->str('files') . "</td>\n\t\t\t<td class=thead align=right>" . $this->str('size') . "</td>\n\t\t\t<td class=thead>&nbsp;</td>\n\t\t\t</tr>\n\t\t\t<script>\n\t\t\tfunction openImport(url) {\n\t\t\t\twindow.open(url,\"importwindow\",\"toolbar=no,menubar=no,location=no,height=350,width=500\")\n\t\t\t}\n\t\t\t</script>\n\t\t\t";
            $counter = 0;
            if (!empty($files)) {
                foreach ($files as $entry) {
                    $counter++;
                    $style = " class=" . ($counter % 2 == 0 ? 'odd' : 'white');
                    $ret .= "\n\t\t\t\t<tr>\n\t\t\t\t<td" . $style . " align=center class=note>" . $counter . "</td>\n\t\t\t\t<td" . $style . " align=center><a href='#' onclick='if(confirm(\"" . $this->str('ask_import') . "\")) openImport(\"?page=" . $this->name . "&do=import&fname=" . $entry . "\");return false;'><img src='images/icons/icon.movedown.gif' width=16 height=16 border=0></a></td>\n\t\t\t\t<td" . $style . "><a class=tedit href='?page=" . $this->name . "&do=downloadfile&name=" . $entry . "'>" . $entry . "</a></td>\n\t\t\t\t<td" . $style . " align=right>" . number_format(filesize(DIR . '/' . $entry)) . "</td>\n\t\t\t\t<td" . $style . " align=center><a href='?page=" . $this->name . "&do=delete&id=" . $entry . "' onclick='return confirm(\"" . $this->str('c_del') . "\")'><img src='images/icons/icon.delete.gif' width=16 height=16 border=0></a></td>\n\t\t\t\t</tr>\n\t\t\t\t";
                }
            }
            $d->close();
            if (!$counter) {
                $ret .= "<tr><td class=white colspan=5>" . $this->str('empty') . "</td></tr>";
            }
            $ret .= "</table>\n";
        } else {
            $ret .= "<div class=red>Error: read dir `" . DIR . "` failed.</div>";
        }
        # Таблица с краткой статистикой по базе
        $ret .= "\n\t\t<h5>" . $this->str('status') . "</h5>\n\t\t<table cellpadding=3 cellspacing=1 class=framed width=100%>\n\t\t<tr class=thead>\n\t\t<td class=thead align=center>" . $this->str('table_count') . "</td>\n\t\t<td class=thead align=center>" . $this->str('table_rows') . "</td>\n\t\t<td class=thead align=center>" . $this->str('table_data') . "</td>\n\t\t<td class=thead align=center>" . $this->str('table_index') . "</td>\n\t\t<td class=thead align=center>" . $this->str('table_date') . "</td>\n\t\t</tr>\n\t\t";
        $status = array('count' => 0, 'rows' => 0, 'data' => 0, 'index' => 0, 'date' => 0);
        $rows = sql_query("SHOW TABLE STATUS");
        while ($row = mysql_fetch_assoc($rows)) {
            $status['count']++;
            $status['rows'] += $row['Rows'];
            $status['data'] += $row['Data_length'];
            $status['index'] += $row['Index_length'];
            if ($row['Update_time']) {
                $row['Update_time'] = strtotime($row['Update_time']);
            }
            if ($row['Update_time'] > $status['date']) {
                $status['date'] = $row['Update_time'];
            }
        }
        $ret .= "\n\t\t<tr>\n\t\t<td class=white align=center>" . $status['count'] . "</td>\n\t\t<td class=white align=center>" . number_format($status['rows']) . "</td>\n\t\t<td class=white align=center>" . number_format($status['data']) . "</td>\n\t\t<td class=white align=center>" . number_format($status['index']) . "</td>\n\t\t<td class=white align=center>" . fmt_date($status['date']) . "</td>\n\t\t</tr>\n\t\t</table>\n\t\t";
        $row = sql_getRow("select version() as ver");
        $mysql_version = $row["ver"];
        # Форма создания дампа
        $ret .= "\n        <form id=form_export method=post action='' onsubmit='this.subm.disabled=true;window.open(\"\",\"dumpwindow\",\"toolbar=no,menubar=no,location=no,height=200,width=400\")' target='dumpwindow'>\n            <input type=hidden name=server value='" . MYSQL_HOST . "'>\n            <input type=hidden name=db value='" . MYSQL_DB . "'>\n            <input type=hidden name=mysql_version value='{$mysql_version}'>\n            <input type=hidden name=use_backquotes value=1>\n\n\n            <input type=hidden name=drop value='1'>\n\n            <br />\n            <fieldset><legend>" . $this->str('create') . "</legend>\n                <table cellpadding=0 cellspacing=0>\n                    <tr>\n                        <td valign=top>\n                            <select class=fForm name='tables[]' size=5 MULTIPLE style='height: 250px;'>\n                                " . $this->GetArrayOptions(sql_getRows('show tables'), '') . "\n                            </select>\n                        </td>\n                        <td valign=bottom>&nbsp;</td>\n                        <td valign=top>\n                            <div><label class='float margBottom' for=all>" . $this->str('options') . ":</label></div>\n                            <div class='checkBox'>\n                                <input id=no_data type=radio name=what value='structure'>\n                                <label class='check' for=no_data>" . $this->str('no_data') . "</label>\n                            </div>\n                            <div class='checkBox'>\n                                <input id=all type=radio name=what value='data' CHECKED>\n                                <label class='check' for=all>" . $this->str('all') . "</label>\n                            </div>\n                            <div class='checkBox margBottom'>\n                                <input id=no_create_info type=radio name=what value='dataonly'>\n                                <label class='check' for=no_create_info>" . $this->str('no_create_info') . "</label>\n                            </div>\n\n                            <div><label class='float margBottom' for=all>" . $this->str('dropoptions') . ":</label></div>\n                            <div class='checkBox'>\n                                <input id=deltable1 type=radio name=drop value='1' CHECKED>\n                                <label class='check' for=deltable1>" . $this->str('drop') . "</label>\n                            </div>\n                            <div class='checkBox'>\n                                <input id=deltable0 type=radio name=drop value='0' CHECKED>\n                                <label class='check' for=deltable0>" . $this->str('nodrop') . "</label>\n                            </div>\n                            " . "</td>\n                        <td valign=bottom>&nbsp;</td>\n                        <td valign=top>\n                            <div><label class='float margBottom' for=gzip>" . $this->str('as') . ":</label></div>" . "\n                            <div class='checkBox'>\n                                <input id=file type=radio name=as value=file>\n                                <label class='check' for=file>" . $this->str('file') . "</label>\n                            </div>\n                            <div class='checkBox'>\n                                <input id=gzip type=radio name=as value=gzip CHECKED>\n                                <label class='check' for=gzip>" . $this->str('gzip') . "</label>\n                            </div>\n                            <div class='checkBox margBottom'>\n                                <input id=bzip type=radio name=as value=bzip>\n                                <label class='check' for=bzip>" . $this->str('bzip') . "</label>\n                            </div>\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\n                            <div><label class='float margBottom' for=ereplace>" . $this->str('exptype') . ":</label></div>" . "\n                            <div class='checkBox'>\n                                <input id=einsert type=radio name=exptype value=einsert CHECKED>\n                                <label class='check' for=einsert>" . $this->str('einsert') . "</label>\n                            </div>\n                            <div class='checkBox'>\n                                <input id=eupdate type=radio name=exptype value=eupdate>\n                                <label class='check' for=eupdate>" . $this->str('eupdate') . "</label>\n                            </div>\n                            <div class='checkBox'>\n                                <input id=ereplace type=radio name=exptype value=ereplace>\n                                <label class='check' for=ereplace>" . $this->str('ereplace') . "</label>\n                            </div>\n\t\t\t\t\t\t\t\n                        </td>\n\n                        <td valign=bottom>&nbsp;</td>\n                        <td valign=top>\n\n                        </td>\n\n                    </tr>\n                </table>" . "\n                <a class='button' href='javascript:document.getElementById(\"form_export\").submit();'>" . $this->str('submit') . "</a>\n                <input type=hidden name=page value=" . $this->name . ">\n                <input type=hidden name=do value=editdump>\n            </fieldset>\n        </form>\n\t\t\n\t\t<script>\n\t\t\tfunction set_cb_State(elems,state) {\n\t\t\t\tif (state)\n\t\t\t\t\telems.attr('disabled','disabled');\n\t\t\t\telse\n\t\t\t\t\telems.removeAttr('disabled');\n\t\t\t};\n\t\t\tfunction updstates() {\n\t\t\t\tset_cb_State(\$('#eupdate, #einsert, #ereplace'),\$('#no_data').is(':checked'));\n\t\t\t\tset_cb_State(\$('#deltable1, #deltable0'),\$('#no_create_info').is(':checked'));\n\t\t\t};\n\t\t\t\$('fieldset input').click(updstates);\n\t\t</script>\n\t\t\n\t\t";
        # Форма импорта данных
        $ret .= "\n        <form id='form_import' method='post' action='' enctype='multipart/form-data'>\n            <fieldset><legend>" . $this->str('import') . "</legend>\n                <br />\n                <input type=hidden name=page value=" . $this->name . ">\n                <input type=hidden name=do value=upload>\n\n                <div class='margBottom elemBox file'>\n                    <label class='float' for=upload_file>" . $this->str('upload_file') . ":</label> <input type='text' readonly='readonly' name='' value='' class='text' id='upload_file'>\n                    <div class='inputBox'>\n                        <span class='note floatRight'>( file_uploads=" . ini_get('file_uploads') . "; upload_max_filesize=" . ini_get('upload_max_filesize') . "; post_max_size=" . ini_get('post_max_size') . " )</span>\n                        <a title='выберите файл' class='fileButton'><input type='file' onchange='document.getElementById(\"upload_file\").value=this.value;' name='file'>Обзор...</a>\n                    </div>\n                </div>\n                <div class='checkBox'>\n                    <input id=exec type=checkbox name=exec>\n                    <label class='check' for=exec>" . $this->str('exec') . "</label>\n                </div>\n                <div class='checkBox'>\n                    <input id=upload_del type=checkbox name=del>\n                    <label class='check' for=upload_del>" . $this->str('upload_del') . "</label>\n                </div>\n                <a class='button' href='javascript:void(0);'>" . $this->str('upload') . "</a>\n            </fieldset>\n        </form>\n\t\t<script>\n\t\t\t\$(document).ready(function() {\n\t\t\t\t\$('#exec').click(function(){\n\t\t\t\t\tif (\$(this).is(':checked'))\n\t\t\t\t\t\t\$('#form_import').attr('target','importwindow');\n\t\t\t\t\telse\n\t\t\t\t\t\t\$('#form_import').removeAttr('target');\n\t\t\t\t});\n\t\t\t\t\$('form#form_import a.button').click(function(){\n\t\t\t\t\tdocument.getElementById('form_import').submit();\n\t\t\t\t\tif (\$('form#form_import').attr('target')=='importwindow') \n\t\t\t\t\tlocation.reload(true);\n\t\t\t\t});\n\t\t\t});\n\t\t</script>\n\t\t";
        //$ret.= PageFooter();
        return $ret;
    }