本文整理汇总了PHP中Check::digits方法的典型用法代码示例。如果您正苦于以下问题:PHP Check::digits方法的具体用法?PHP Check::digits怎么用?PHP Check::digits使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Check
的用法示例。
在下文中一共展示了Check::digits方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: smarty_function_tasklist2xml
/**
* return the tasklist as an xml document that
* would be used by the drdat app on a phone
*/
function smarty_function_tasklist2xml($params, &$smarty)
{
if (!Check::digits($params['study_id'], $empty = false)) {
return;
}
$s = new Schedule();
return htmlentities($s->tasklist2xml($params['study_id']));
}
示例2: smarty_function_task
/**
* get task information for the specified task
*/
function smarty_function_task($params, &$smarty)
{
$t = new Task();
if (!Check::digits($params['task_id'], $empty = false)) {
return;
}
$smarty->assign('task', $t->getone($params['task_id']));
}
示例3: smarty_function_tasks
/**
* find the tasks for this particular study
*/
function smarty_function_tasks($params, &$smarty)
{
$t = new Task();
if (!Check::digits($params['study_id'])) {
return;
}
$smarty->assign('tasks', $t->tasks($params['study_id'], $_SESSION['user']['researcher_id'], $params['all'] ? true : false));
}
示例4: smarty_function_forms
/**
* take our raw form data and make a data structure out of it
* that can be used in templates
*/
function smarty_function_forms($params, &$smarty)
{
if (!Check::digits($params['task_id'], $empty = false)) {
return;
}
$t = new Task();
$smarty->assign('forms', $t->parseforms($params['task_id']));
}
示例5: smarty_function_part
/**
* get data for a participant and create a smarty $part variable
*/
function smarty_function_part($params, &$smarty)
{
if (!Check::digits($params['part_id'], $empty = false)) {
return;
}
$p = new Participant();
$smarty->assign('part', $p->getone($params['part_id']));
}
示例6: smarty_function_formhtml
/**
* take our raw form data and make an xml representation of it
* that should be exactly what gets sent to the phones
*/
function smarty_function_formhtml($params, &$smarty)
{
if (!Check::digits($params['task_id'], $empty = false)) {
return;
}
# study_id is needed for the scheduling information for the task
if (!Check::digits($params['study_id'], $empty = false)) {
return;
}
$t = new Task();
if ($params['style'] == 'mobile') {
if ($params['width'] > 0) {
$width = (int) $params['width'];
} else {
$width = 400;
}
$rawhtml = $t->forms2html($params['task_id'], $params['study_id']);
$forms = explode('<!-- split -->', $rawhtml);
$numforms = count($forms) - 1;
foreach ($forms as $block) {
$f++;
if ($f > $numforms) {
break;
}
$spacer = "";
if ($f == 1) {
$prev = "< prev";
$next = "<input type=submit value=\"next >\">";
} else {
if ($f < $numforms) {
$prev = "<input type=submit value=\"< prev\">";
$next = "<input type=submit value=\"next >\">";
} else {
$prev = "<input type=submit value=\"< prev\">";
}
}
if ($f == $numforms) {
$next = "<input type=submit value=\"Save data\">";
$spacer = "<br><br><br>";
}
$html .= <<<HTML
<h4>Form {$f}</h4>
<table cellpadding=2 cellspacing=0 border=1 style="width: {$width}" width={$width} class="nobgcolor">
<tr><td>
{$block}
<br>
{$prev} {$next}
<br><br>
</td></tr>
</table>
{$spacer}
HTML;
}
return $html;
}
return htmlentities($t->forms2html($params['task_id'], $params['study_id']));
}
示例7: smarty_function_schedule
/**
* grab the schedule for a task in a study
*/
function smarty_function_schedule($params, &$smarty)
{
if (!Check::digits($params['study_id'])) {
return;
}
if (!Check::digits($params['task_id'])) {
return;
}
$s = new Schedule();
$smarty->assign('schedule', $s->getone(array('study_id' => $params['study_id'], 'task_id' => $params['task_id'])));
}
示例8: smarty_function_formxml
/**
* take our raw form data and make an xml representation of it
* that should be exactly what gets sent to the phones
*/
function smarty_function_formxml($params, &$smarty)
{
if (!Check::digits($params['task_id'], $empty = false)) {
return;
}
# study_id is needed for the scheduling information for the task
if (!Check::digits($params['study_id'], $empty = false)) {
return;
}
$t = new Task();
return htmlentities($t->forms2xml($params['task_id'], $params['study_id']));
}
示例9: smarty_function_parts
/**
* get data for all participants in a study and create a smarty $parts variable
*/
function smarty_function_parts($params, &$smarty)
{
if (!Check::digits($params['study_id'], $empty = false)) {
return;
}
if ($params['all']) {
$active = null;
} else {
$active = 1;
}
$p = new Participant();
$smarty->assign('parts', $p->studyparts($_SESSION['user']['researcher_id'], $params['study_id'], $active));
}
示例10: smarty_function_study
/**
* get data for an individual study based on
* the user's researcher_id and a supplied study_id
* creates $study smarty variable
*/
function smarty_function_study($params, &$smarty)
{
if (!Check::digits($params['study_id'])) {
$smarty->assign('study', array());
return;
}
$s = new Study();
$study = $s->study($_SESSION['user']['researcher_id'], $params['study_id']);
$p = new Enrollment();
$participants = $p->howmany(array(" where study_id=%u and active>0 ", $params['study_id']));
$smarty->assign('study', $study);
$smarty->assign('participants', $participants);
}
示例11: downloaddata
public function downloaddata()
{
try {
if (Check::digits($_REQUEST['study_id'], $empty = false)) {
$study_id = $_REQUEST['study_id'];
} else {
throw new Exception("bad study id!");
}
global $studyname;
$studyname = "study_{$study_id}";
if (isset($_REQUEST['task_id'])) {
if (Check::digits($_REQUEST['task_id'], $empty = false)) {
$task_id = $_REQUEST['task_id'];
} else {
throw new Exception("bad task id!");
}
$studyname .= "-task_{$task_id}";
}
if (isset($_REQUEST['email'])) {
if (Check::isemail($_REQUEST['email'], $empty = false)) {
$email = $_REQUEST['email'];
} else {
throw new Exception("bad email!");
}
if (Check::ismd5($_REQUEST['password'])) {
$password = $_REQUEST['password'];
} else {
throw new Exception("bad password!");
}
$studyname .= "-{$email}";
}
$d = new Data();
View::assign('csv', $d->task2CSV($study_id, $task_id, $email, $password));
View::assign('studyname', $studyname);
global $contenttype;
$contenttype = 'text-csv';
return 'downloaddata.tpl';
} catch (Exception $e) {
$this->err($e);
View::assign('error', $this->error);
return 'error.tpl';
}
}
示例12: tasklist
public function tasklist($_id, $_extra = null)
{
try {
$empty = false;
if (!Check::digits($_id, $empty)) {
if (!Check::isemail($_id, $empty)) {
throw new Exception("bad email!");
}
if (!Check::ismd5($_extra)) {
throw new Exception("bad pw!");
}
$where = "where participant.email='%s' and participant.password='%s' ";
} else {
$where = "where study.study_id=%u ";
}
$this->run("select distinct task.task_id, task.task_title, schedule.* " . "from task join schedule using (task_id) " . "join study using (study_id) " . "join enrollment using (study_id) " . "join participant using (participant_id) " . $where . "and study.startdate <= schedule.startdate " . "and study.enddate >= schedule.enddate " . "and schedule.active = 1 " . "order by task.task_id", $_id, $_extra);
return $this->resultarray();
} catch (Exception $e) {
$this->err($e);
return false;
}
}