本文整理汇总了PHP中Requirement类的典型用法代码示例。如果您正苦于以下问题:PHP Requirement类的具体用法?PHP Requirement怎么用?PHP Requirement使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Requirement类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testRequirementSuccess
public function testRequirementSuccess()
{
$requirement = new Requirement();
$requirement->protocol_id = 1;
$requirement->family = "user";
$requirement->parameter_id = 1;
$this->assertTrue($requirement->save());
}
示例2: get_error_message
function get_error_message(Requirement $requirement, $lineSize)
{
if ($requirement->isFulfilled()) {
return;
}
$errorMessage = wordwrap($requirement->getTestMessage(), $lineSize - 3, PHP_EOL . ' ') . PHP_EOL;
$errorMessage .= ' > ' . wordwrap($requirement->getHelpText(), $lineSize - 5, PHP_EOL . ' > ') . PHP_EOL;
return $errorMessage;
}
示例3: req_row
function req_row(Requirement $req, $indentation, TableCreator $table_creator)
{
$req->with('validationTest', 'requirements');
$ret = "";
$ret .= $table_creator->row(array($table_creator->child_indentation($indentation), $req->public_id(), $req->validationTest == null ? '' : $req->validationTest->public_id()));
$nested = $req->requirements;
foreach ($nested as $c) {
$ret .= req_row($c, $indentation + 1, $table_creator);
}
return $ret;
}
示例4: test_row
function test_row(Requirement $req, $indentation, TableCreator $table_creator, $filter_cat, $filter_pri)
{
$test = $req->with('system_test')->system_test;
$ret = "";
if (isset($req->system_test) && (!is_numeric($filter_cat) || $req->category == $filter_cat) && (!is_numeric($filter_pri) || $req->priority == $filter_pri)) {
$test->with('test');
$ret .= $table_creator->row(array($test->public_id(), $test->test->description, 'success', $table_creator->anchor($req->public_id(), $req->public_id())));
}
$nested = $req->with('requirements')->requirements;
foreach ($nested as $nreq) {
$ret .= test_row($nreq, $indentation + 1, $table_creator, $filter_cat, $filter_pri);
}
return $ret;
}
示例5: test_row
function test_row(Requirement $req, $indentation, TableCreator $table_creator, $filter_cat, $filter_pri)
{
$test = $req->with('system_test')->system_test;
$validation = $req->with('validation0')->validation0;
$ret = "";
$rv = '';
if (isset($test)) {
$rv = $test->public_id();
} else {
if (isset($validation)) {
$rv = $validation->name;
}
}
$ret .= $table_creator->row(array($table_creator->child_indentation($indentation), $req->public_id(), $rv));
$nested = $req->with('requirements')->requirements;
foreach ($nested as $nreq) {
$ret .= test_row($nreq, $indentation + 1, $table_creator, $filter_cat, $filter_pri);
}
return $ret;
}
示例6: echo_requirement
/**
* Prints a Requirement instance
*/
private function echo_requirement(\Requirement $requirement)
{
$result = $requirement->isFulfilled() ? 'OK' : ($requirement->isOptional() ? 'WARNING' : 'ERROR');
$data = '';
switch (rtrim(ltrim(str_pad($result, 9)))) {
case 'OK':
$data .= '<tr class="success">';
break;
case 'WARNING':
$data .= '<tr class="warning">';
break;
case 'ERROR':
$data .= '<tr class="danger">';
break;
default:
$data .= '<tr>';
break;
}
$data .= '<td>' . str_pad($result, 9) . '</td>';
$data .= '<td>' . $requirement->getTestMessage() . "</td>";
if (!$requirement->isFulfilled()) {
$data .= '<td>' . $requirement->getHelpText() . '</td>';
}
$data .= '</tr>';
return $data;
}
示例7: alter
public function alter()
{
if (!isset($_SESSION['logged'])) {
return call('pages', 'home');
} else {
if (!isset($_GET['code'])) {
return call('pages', 'error', 2);
}
$sources = Sources::all();
$requirement = Requirement::get($_GET['code']);
require_once 'views/requirements/alter.php';
}
}
示例8: echo_requirement
/**
* Prints a Requirement instance
*/
function echo_requirement(Requirement $requirement)
{
$result = $requirement->isFulfilled() ? 'OK' : ($requirement->isOptional() ? 'WARNING' : 'ERROR');
echo ' ' . str_pad($result, 9);
echo $requirement->getTestMessage() . "\n";
if (!$requirement->isFulfilled()) {
echo sprintf(" %s\n\n", $requirement->getHelpText());
}
}
示例9: save
public function save()
{
// yo thau ma requirement save huna aaucha
// yei bata feri "index.php" ma falne jun chai profile ma jancha
$req = new Requirement();
if (isset($_POST['title'])) {
$req->setTitle($_POST['title']);
} else {
$req->setTitle("");
}
if (isset($_POST['date'])) {
$req->setDate($_POST['date']);
} else {
$req->setDate("01-01-2001");
}
if (isset($_POST['details'])) {
$req->setDescription($_POST['details']);
} else {
$req->setDescription("");
}
$req->setStatus(1);
$req->setOrgname("");
$this->requirement_repository->insert($req);
}
示例10: download_tex
public function download_tex()
{
if (!isset($_SESSION['logged'])) {
$this->login();
} else {
$rs = Requirement::reqSources();
$sr = Requirement::sourcesReq();
$frq = Requirement::functionalRequirements();
$tex = "\\section{Requisiti funzionali}<br>\n \\begin{longtable}[H]{|l|p{2cm}|p{6cm}|p{4cm}|}<br>\n \\hline<br>\n \\textbf{Requisito} & \\textbf{Tipologia} & \\textbf{Descrizione} & \\textbf{Fonti}\\\\<br>\n \\hline<br>";
foreach ($frq as $funcReq) {
if ($funcReq->getType() == 'F') {
$type = 'Funzionale';
} elseif ($funcReq->getType() == 'T') {
$type = 'Tecnologico';
} elseif ($funcReq->getType() == 'Q') {
$type = 'Qualitativo';
} elseif ($funcReq->getType() == 'B') {
$type = 'Vincolo';
}
$tex .= $funcReq->getCode() . " & \\multiLineCell{" . $type . "\\\\" . $funcReq->getPriority() . "} & " . $funcReq->getDescription() . " & \\multiLineCell{";
foreach ($funcReq->getSources() as $sources) {
$tex .= $sources->getName() . "\\\\";
}
$tex .= "}\\\\<br>\n \\hline<br>";
}
$tex .= "\\end{longtable}<br>";
$tex .= "\\section{Tracciamento Requisiti-Fonti}<br>\n \\begin{longtable}[H]{|p{5.5cm}|p{5.5cm}|}<br>\n \\hline<br>\n \\textbf{Requisito} & \\textbf{Fonti}\\\\<br>\n \\hline<br>";
foreach ($rs as $key => $val) {
$tex .= $key . " & \\multiLineCell[t]{";
foreach ($val as $v) {
$tex .= $v . "\\\\";
}
$tex .= "}\\\\<br>\n \\hline<br>";
}
$tex .= "\\end{longtable}<br>\n \\section{Tracciamento Fonti-Requisiti}<br>\n \\begin{longtable}[H]{|p{5.5cm}|p{5.5cm}|}<br>\n \\hline<br>\n \\textbf{Fonte} & \\textbf{Requisiti}\\\\<br>\n \\hline<br>";
foreach ($sr as $key => $val) {
$tex .= $key . " & \\multiLineCell[t]{";
foreach ($val as $v) {
$tex .= $v . "\\\\";
}
$tex .= "}\\\\<br>\n \\hline<br>";
}
$tex .= "\\end{longtable}<br>";
require_once 'views/pages/output.php';
}
}
示例11: requirement_row
function requirement_row($req, $indentation, TableCreator $table_creator, $filter_cat, $filter_pri)
{
$ret = "";
if ((!is_numeric($filter_cat) || $req->category == $filter_cat) && (!is_numeric($filter_pri) || $req->priority == $filter_pri)) {
$pkg_name = array();
foreach ($req->classes as $c) {
array_push($pkg_name, $table_creator->link($c->full_name(), $c->name));
}
array_unique($pkg_name);
sort($pkg_name);
$cells = array($table_creator->child_indentation($indentation), $table_creator->link($req->public_id(), $req->public_id()), implode("\n\n", $pkg_name));
$ret .= $table_creator->row($cells);
}
$nested = Requirement::model()->with('classes')->findAll("t.parent=:parent", array(':parent' => $req->id_requirement));
foreach ($nested as $nreq) {
$ret .= requirement_row($nreq, $indentation + 1, $table_creator, $filter_cat, $filter_pri);
}
return $ret;
}
示例12: __construct
/**
* Constructor that initializes the requirement.
*
* @param string $cfgName The configuration name used for ini_get()
* @param Boolean|callback $evaluation Either a Boolean indicating whether the configuration should evaluate to true or false,
or a callback function receiving the configuration value as parameter to determine the fulfillment of the requirement
* @param Boolean $approveCfgAbsence If true the Requirement will be fulfilled even if the configuration option does not exist, i.e. ini_get() returns false.
This is helpful for abandoned configs in later PHP versions or configs of an optional extension, like Suhosin.
Example: You require a config to be true but PHP later removes this config and defaults it to true internally.
* @param string|null $testMessage The message for testing the requirement (when null and $evaluation is a Boolean a default message is derived)
* @param string|null $helpHtml The help text formatted in HTML for resolving the problem (when null and $evaluation is a Boolean a default help is derived)
* @param string|null $helpText The help text (when null, it will be inferred from $helpHtml, i.e. stripped from HTML tags)
* @param Boolean $optional Whether this is only an optional recommendation not a mandatory requirement
*/
public function __construct($cfgName, $evaluation, $approveCfgAbsence = false, $testMessage = null, $helpHtml = null, $helpText = null, $optional = false)
{
$cfgValue = ini_get($cfgName);
if (is_callable($evaluation)) {
if (null === $testMessage || null === $helpHtml) {
throw new InvalidArgumentException('You must provide the parameters testMessage and helpHtml for a callback evaluation.');
}
$fulfilled = call_user_func($evaluation, $cfgValue);
} else {
if (null === $testMessage) {
$testMessage = sprintf('%s %s be %s in php.ini', $cfgName, $optional ? 'should' : 'must', $evaluation ? 'enabled' : 'disabled');
}
if (null === $helpHtml) {
$helpHtml = sprintf('Set <strong>%s</strong> to <strong>%s</strong> in php.ini<a href="#phpini">*</a>.', $cfgName, $evaluation ? 'on' : 'off');
}
$fulfilled = $evaluation == $cfgValue;
}
parent::__construct($fulfilled || $approveCfgAbsence && false === $cfgValue, $testMessage, $helpHtml, $helpText, $optional);
}
示例13: actionRequirementHandle
public function actionRequirementHandle()
{
if (parent::_ajax_acl('evaluate_update')) {
$id = Yii::app()->request->getPost('id');
$requirement = Requirement::model()->findByPk($id);
if (!empty($requirement)) {
$requirement->status = 1;
if ($requirement->save()) {
AdminLogger::_create(array('catalog' => 'update', 'intro' => '更新学区专栏房源需求处理状态,ID:' . $requirement->id));
echo CJSON::encode(array('success' => true, 'msg' => '需求处理成功'));
} else {
echo CJSON::encode(array('success' => false, 'msg' => '操作失败,请联系管理员'));
}
} else {
echo CJSON::encode(array('success' => false, 'msg' => '此需求不存在'));
}
} else {
echo CJSON::encode(array('success' => false, 'msg' => '当前角色组无权限进行此操作,请联系管理员授权'));
}
}
示例14: requirement_row
function requirement_row($req, $indentation, TableCreator $table_creator, $filter_cat, $filter_pri)
{
$ret = "";
if ((!is_numeric($filter_cat) || $req->category == $filter_cat) && (!is_numeric($filter_pri) || $req->priority == $filter_pri)) {
$source_desc = array();
foreach ($req->sources as $rc) {
$rc->with('useCase', 'externalSource');
if (isset($rc->useCase)) {
array_push($source_desc, $table_creator->link($rc->useCase->public_id(), $rc->useCase->public_id()));
} else {
array_push($source_desc, $rc->externalSource->description);
}
}
sort($source_desc);
$cells = array($table_creator->child_indentation($indentation), $table_creator->anchor($req->public_id(), $req->public_id()), $req->category0->name . "\n\n" . $req->priority0->name, $req->description, implode("\n\n", $source_desc));
$ret .= $table_creator->row($cells);
}
$nested = Requirement::model()->with('sources', 'category0', 'priority0')->findAll("t.parent=:parent", array(':parent' => $req->id_requirement));
foreach ($nested as $nreq) {
$ret .= requirement_row($nreq, $indentation + 1, $table_creator, $filter_cat, $filter_pri);
}
return $ret;
}
示例15: __construct
/**
* @return WebRootExposedFolderRequirement
*/
public function __construct()
{
parent::__construct(Craft::t('Sensitive Craft folders should not be publicly accessible'), null, false, '<a href="http://craftcms.com">Craft CMS</a>');
}