예제 #1
0
?>
tv/search/<?php 
echo str_replace('%2F', '/', rawurlencode('^' . $schedule->title . '$'));
?>
?field=title"><?php 
echo $schedule->title;
if ($schedule->subtitle) {
    echo ':<br>', $schedule->subtitle;
}
?>
</a>
                <div id="x-time"><?php 
echo strftime('%a, %b %e', $schedule->starttime);
echo ', ' . t('$1 to $2', strftime($_SESSION['time_format'], $schedule->starttime), strftime($_SESSION['time_format'], $schedule->endtime));
if ($program) {
    echo ' (' . tn('$1 min', '$1 mins', intval($program->length / 60)) . ')';
}
echo "<br>\n";
?>
</div>
                </td>
        </tr><?php 
if (!empty($schedule->fancy_description)) {
    ?>
<tr>
            <td id="x-description" colspan="2">
                <?php 
    echo nl2br($schedule->fancy_description);
    ?>
            </td>
        </tr><?php 
예제 #2
0
파일: select.html.php 프로젝트: jivoo/jivoo
        ?>
<td>
<?php 
        echo tr('Available');
        ?>
</td>
<td>
<?php 
        echo $Form->submit(tr('Select %1', $driver['name']), array('name' => $Form->name($driver['driver']), 'class' => 'primary'));
        ?>
</td>
<?php 
    } else {
        ?>
<td colspan="2" class="error">
<?php 
        echo tn('Unavailable. Missing the "%1{", "}{" and "}" PHP extensions', 'Unavailable. Missing the "%1{", "}{" and "}" PHP extension', $driver['missingExtensions']);
        ?>
</td>
<?php 
    }
    ?>
</tr>
<?php 
}
?>
</tbody>
</table>

<?php 
$this->data->form = $Form->end();
예제 #3
0
/**
 * Convert a unix timestamp into an day/hour/minute string
 *
 * @param int $length time to convert.
 *
 * @return string Translated hour/minute string.
/**/
function nice_length($length)
{
    $years = intVal($length / 31556926);
    $length = $length - $years * 31556926;
    $months = intVal($length / 2629743);
    $length = $length - $months * 2629743;
    $days = intVal($length / 86400);
    $length = $length - $days * 86400;
    $hours = intVal($length / 3600);
    $length = $length - $hours * 3600;
    $mins = intVal($length / 60);
    $ret = '';
    if ($years > 0) {
        $ret = tn('$1 year', '$1 years', $years);
    }
    if ($months > 0) {
        $ret .= ' ' . tn('$1 month', '$1 months', $months);
    }
    if ($days > 0) {
        $ret .= ' ' . tn('$1 day', '$1 days', $days);
    }
    if ($hours > 0) {
        $ret .= ' ' . tn('$1 hr', '$1 hrs', $hours);
    }
    if ($mins > 0) {
        $ret .= ' ' . tn('$1 min', '$1 mins', $mins);
    }
    return trim($ret);
}
예제 #4
0
<!--    <td class="x-recordings"><?php 
echo t('Show recordings');
?>
:</td>
    <td><select name="title" onchange="$('change_title').submit()">
        <option id="All recordings" value=""><?php 
echo t('All recordings');
?>
</option>
<?php 
foreach ($Program_Titles as $title => $count) {
    echo '<option id="Title ' . htmlspecialchars($title) . '" value="' . htmlspecialchars($title) . '"';
    if ($_REQUEST['title'] == $title) {
        echo ' SELECTED';
    }
    echo '>' . html_entities($title) . ($count > 1 ? ' (' . tn('$1 episode', '$1 episodes', $count) . ')' : "") . "</option>\n";
}
?>
-->
    </select></td>
</tr>
</table>
</form>
<table id="recorded_list" border="0" cellpadding="0" cellspacing="0" class="list small"  style="display: block">
<tr class="menu">
    <th colspan="2" style="width:10%;"></th>
    <th class="x-title" style="width:50%;"><?php 
echo get_sort_link('title', t('Title'));
?>
</th>
    <th class="x-airdate" style="width:10%;"><?php 
예제 #5
0
?>
: <input type="password" name="VideoAdminPassword" value="<?php 
echo $_SESSION['video']['VideoAdminPassword'];
?>
" size="5">
  <input type="submit" class="submit" value="<?php 
echo t('Update');
?>
">
 </form>
</td>
<td style="text-align: right;">
 <?php 
$video_count = count($All_Videos);
if ($video_count) {
    echo tn('$1 video', '$1 videos', $video_count);
} else {
    echo t('No videos');
}
?>
</td>
</tr>
</table>

<div id="videos">

<div id="path">
  <b><?php 
echo t('Directory Structure');
?>
</b><hr>
        $schedule->autotranscode = $_POST['autotranscode'] ? 1 : 0;
        $schedule->transcoder = $_POST['transcoder'];
        // Figure out the title
        $channel =& Channel::find($_POST['channel']);
        if (strcasecmp($_POST['title'], t('Use callsign')) == 0) {
            if ($_SESSION["prefer_channum"]) {
                $schedule->title = $channel->channum . ' (' . $channel->callsign . ')';
            } else {
                $schedule->title = $channel->callsign . ' (' . $channel->channum . ')';
            }
        } else {
            $schedule->title = $_POST['title'];
        }
        // Now the subtitle
        if (strcasecmp($_POST['subtitle'], t('Use date/time')) == 0) {
            $schedule->subtitle = date('Y-m-d H:i:s', $schedule->starttime) . ' (' . tn('$1 min', '$1 mins', $_POST['length']) . ')';
        } else {
            $schedule->subtitle = $_POST['subtitle'];
        }
        // Save the schedule
        $schedule->save($type);
        // Redirect to the new schedule
        header('Location: ' . root_url . 'tv/schedules/manual/' . $schedule->recordid);
        exit;
    }
} else {
    // Default title/subtitle
    if (!$schedule->title) {
        $schedule->title = t('Use callsign');
        $schedule->subtitle = t('Use date/time');
    }
예제 #7
0
 /**
  * Validate a rule on a record.
  * @param Record $record A record.
  * @param string $field Field name.
  * @param string $ruleName Name of rule.
  * @param mixed $rule Value of rule.
  * @return true|string True if valid, otherwise returns an error message.
  */
 public static function validateRule(Record $record, $field, $ruleName, $rule)
 {
     if ($rule instanceof ValidatorRule) {
         return $rule->validate($record, $field);
     }
     $value = $record->{$field};
     if ($ruleName != 'presence' and $ruleName != 'null' and $ruleName != 'callback' and ($value == null or $value == '')) {
         return true;
     }
     //    if (!is_scalar($value)) {
     //      return tr('Must be a scalar.');
     //    }
     switch ($ruleName) {
         case 'type':
             return $rule->isValid($value);
         case 'presence':
             if ((!empty($value) or is_numeric($value)) == $rule) {
                 return true;
             } else {
                 return $rule ? tr('Must not be empty.') : tr('Must be empty.');
             }
         case 'null':
             if (is_null($value) == $rule) {
                 return true;
             } else {
                 return $rule ? tr('Must not be set.') : tr('Must be set.');
             }
         case 'email':
             if ((preg_match("/^[a-z0-9.!#\$%&*+\\/=?^_`{|}~-]+@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\$/i", $value) == 1) == $rule) {
                 return true;
             } else {
                 return $rule ? tr('Not a valid email address.') : tr('Must not be an email address.');
             }
         case 'url':
             if ((preg_match("/^https?:\\/\\/[-a-z0-9@:%_\\+\\.~#\\?&\\/=\\[\\]]+\$/i", $value) == 1) == $rule) {
                 return true;
             } else {
                 return $rule ? tr('Not a valid URL.') : tr('Must not be a URL.');
             }
         case 'date':
             $timestamp = false;
             if (preg_match('/^[-+]?\\d+$/', $value) == 1) {
                 $timestamp = (int) $value;
             } else {
                 $timestamp = strtotime($value);
             }
             if (($timestamp !== false) == $rule) {
                 return true;
             } else {
                 return $rule ? tr('Not a valid date.') : tr('Must not be a date.');
             }
         case 'minLength':
             if (strlen($value) >= $rule) {
                 return true;
             } else {
                 return tn('Must be at least %1 characters long.', 'Must be at least %1 character long.', $rule);
             }
         case 'maxLength':
             if (strlen($value) <= $rule) {
                 return true;
             } else {
                 return tn('Must be at most %1 characters long.', 'Must be at most %1 character long.', $rule);
             }
         case 'numeric':
             if (is_numeric($value) == $rule) {
                 return true;
             } else {
                 return $rule ? tr('Must be numeric.') : tr('Must not be numeric.');
             }
         case 'integer':
             if ((preg_match('/^[-+]?\\d+$/', $value) == 1) == $rule) {
                 return true;
             } else {
                 return $rule ? tr('Must be an integer.') : tr('Must not be an integer.');
             }
         case 'float':
             if ((preg_match('/^[-+]?[0-9]*\\.?[0-9]+([eE][-+]?[0-9]+)?$/', $value) == 1) == $rule) {
                 return true;
             } else {
                 return $rule ? tr('Must be a decimal number.') : tr('Must not be a decimal number.');
             }
         case 'boolean':
             if ((preg_match('/^(0|1|true|false|yes|no)$/i', $value) == 1) == $rule) {
                 return true;
             } else {
                 return $rule ? tr('Must be boolean (true or false).') : tr('Must not be boolean.');
             }
         case 'minValue':
             $value = is_float($rule) ? (double) $value : (int) $value;
             if ($value >= $rule) {
                 return true;
             } else {
                 return tr('Must be greater than or equal to %1.', $rule);
             }
         case 'maxValue':
             $value = is_float($rule) ? (double) $value : (int) $value;
             if ($value <= $rule) {
                 return true;
             } else {
                 return tr('Must be less than or equal to %1.', $rule);
             }
         case 'in':
             if (in_array($value, $rule)) {
                 return true;
             } else {
                 return tn('Must be either "%1{", "}{" or "}".', 'Must be "%1{", "}{" or "}".', $rule);
             }
         case 'match':
             if (preg_match($rule, $value) == 1) {
                 return true;
             } else {
                 return tr('Invalid value.');
             }
         case 'unique':
             $selection = $record->getModel();
             if (!$record->isNew()) {
                 $selection = $selection->selectNotRecord($record);
             }
             if (($selection->where($field . ' = ?', $value)->count() == 0) == $rule) {
                 return true;
             } else {
                 return $rule ? tr('Must be unique.') : tr('Must not be unique.');
             }
         case 'callback':
             if (!is_array($rule)) {
                 $rule = array($record->getModel(), $rule);
             }
             if (!is_callable($rule)) {
                 return true;
             } else {
                 return call_user_func($rule, $record, $field);
             }
     }
     return true;
 }
예제 #8
0
function test_decimal()
{
    vecho("Decimal mode: Powers of 2 from -16 to 16\n");
    for ($r = 1 / 32768; $r <= 32768; $r *= 2) {
        tn($r, 5);
    }
    vecho("Decimal mode: Powers of 10 from -9 to 9\n");
    for ($r = 1.0E-9; $r < 1000000000.0; $r *= 10) {
        tn($r, 10);
    }
    vecho("Decimal mode: From 1 to 100 with min 3, showing step points\n");
    for ($r = 1; $r <= 100; $r++) {
        tn($r, 3);
    }
    vecho("Decimal mode: Changing minsteps from 2 thru 20\n");
    for ($min = 2; $min <= 20; $min += 2) {
        tn(197, $min);
    }
}
예제 #9
0
파일: ModelBase.php 프로젝트: jivoo/jivoo
 /**
  * {@inheritdoc}
  */
 public function find($primary)
 {
     $args = func_get_args();
     $primaryKey = $this->getSchema()->getPrimaryKey();
     sort($primaryKey);
     $selection = $this;
     if (count($args) != count($primaryKey)) {
         throw new InvalidSelectionException(tn('find() must be called with %1 parameters', 'find() must be called with %1 parameter', count($primaryKey)));
     }
     for ($i = 0; $i < count($args); $i++) {
         $type = $this->gettype($primaryKey[$i]);
         $selection = $selection->where($primaryKey[$i] . ' = ' . $type->placeholder, $args[$i]);
     }
     return $selection->first();
 }