1
0

Added Code for Updates (Normalized Updates Table)

This commit is contained in:
Mike Schwörer 2014-06-12 15:37:03 +02:00
parent d44c74e361
commit 006cf76ff9
6 changed files with 355 additions and 171 deletions

261
.idea/workspace.xml generated
View File

@ -63,10 +63,10 @@
</component> </component>
<component name="FileEditorManager"> <component name="FileEditorManager">
<leaf> <leaf>
<file leaf-file-name="ProgramsController.php" pinned="false" current="false" current-in-tab="false"> <file leaf-file-name="Program.php" pinned="false" current="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/www/protected/controllers/ProgramsController.php"> <entry file="file://$PROJECT_DIR$/www/protected/models/Program.php">
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
<state line="59" column="49" selection-start="1427" selection-end="1460" vertical-scroll-proportion="-6.8076925" vertical-offset="826" max-vertical-offset="4301"> <state line="63" column="0" selection-start="2117" selection-end="2233" vertical-scroll-proportion="-7.8461537" vertical-offset="867" max-vertical-offset="3621">
<folding /> <folding />
</state> </state>
</provider> </provider>
@ -75,52 +75,25 @@
<file leaf-file-name="view.php" pinned="false" current="true" current-in-tab="true"> <file leaf-file-name="view.php" pinned="false" current="true" current-in-tab="true">
<entry file="file://$PROJECT_DIR$/www/protected/views/programs/view.php"> <entry file="file://$PROJECT_DIR$/www/protected/views/programs/view.php">
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
<state line="129" column="48" selection-start="3207" selection-end="3207" vertical-scroll-proportion="0.36068377" vertical-offset="1982" max-vertical-offset="2669"> <state line="49" column="132" selection-start="1371" selection-end="1371" vertical-scroll-proportion="0.62222224" vertical-offset="469" max-vertical-offset="2703">
<folding /> <folding />
</state> </state>
</provider> </provider>
</entry> </entry>
</file> </file>
<file leaf-file-name="Program.php" pinned="false" current="false" current-in-tab="false"> <file leaf-file-name="ProgramUpdates.php" pinned="false" current="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/www/protected/models/Program.php"> <entry file="file://$PROJECT_DIR$/www/protected/models/ProgramUpdates.php">
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
<state line="205" column="24" selection-start="6462" selection-end="6462" vertical-scroll-proportion="-16.115385" vertical-offset="3066" max-vertical-offset="3638"> <state line="48" column="34" selection-start="1117" selection-end="1117" vertical-scroll-proportion="-13.730769" vertical-offset="459" max-vertical-offset="1853">
<folding /> <folding />
</state> </state>
</provider> </provider>
</entry> </entry>
</file> </file>
<file leaf-file-name="styles.css" pinned="false" current="false" current-in-tab="false"> <file leaf-file-name="ProgramUpdatesLog.php" pinned="false" current="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/www/css/styles.css"> <entry file="file://$PROJECT_DIR$/www/protected/models/ProgramUpdatesLog.php">
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
<state line="564" column="0" selection-start="9894" selection-end="9894" vertical-scroll-proportion="0.0" vertical-offset="9011" max-vertical-offset="9690"> <state line="7" column="32" selection-start="185" selection-end="197" vertical-scroll-proportion="-2.2307692" vertical-offset="61" max-vertical-offset="1836">
<folding />
</state>
</provider>
</entry>
</file>
<file leaf-file-name="expandedLogHeader.php" pinned="false" current="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/www/protected/components/widgets/views/expandedLogHeader.php">
<provider selected="true" editor-type-id="text-editor">
<state line="14" column="41" selection-start="386" selection-end="386" vertical-scroll-proportion="-9.153846" vertical-offset="0" max-vertical-offset="595">
<folding />
</state>
</provider>
</entry>
</file>
<file leaf-file-name="ExpandedLogHeader.php" pinned="false" current="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/www/protected/components/widgets/ExpandedLogHeader.php">
<provider selected="true" editor-type-id="text-editor">
<state line="31" column="55" selection-start="626" selection-end="639" vertical-scroll-proportion="-9.115385" vertical-offset="290" max-vertical-offset="901">
<folding />
</state>
</provider>
</entry>
</file>
<file leaf-file-name="thumbnailProgPreview.php" pinned="false" current="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/www/protected/components/widgets/views/thumbnailProgPreview.php">
<provider selected="true" editor-type-id="text-editor">
<state line="63" column="64" selection-start="1675" selection-end="1675" vertical-scroll-proportion="-41.192307" vertical-offset="0" max-vertical-offset="1394">
<folding /> <folding />
</state> </state>
</provider> </provider>
@ -139,8 +112,6 @@
<component name="IdeDocumentHistory"> <component name="IdeDocumentHistory">
<option name="changedFiles"> <option name="changedFiles">
<list> <list>
<option value="$PROJECT_DIR$/www/protected/components/widgets/FullProgPreview.php" />
<option value="$PROJECT_DIR$/www/protected/components/widgets/ThumbnailProgPreview.php" />
<option value="$PROJECT_DIR$/www/protected/components/widgets/views/Tutorial.md" /> <option value="$PROJECT_DIR$/www/protected/components/widgets/views/Tutorial.md" />
<option value="$PROJECT_DIR$/www/protected/components/widgets/ExpandedLogHeader.php" /> <option value="$PROJECT_DIR$/www/protected/components/widgets/ExpandedLogHeader.php" />
<option value="$PROJECT_DIR$/www/protected/config/env/dev.php" /> <option value="$PROJECT_DIR$/www/protected/config/env/dev.php" />
@ -187,9 +158,11 @@
<option value="$PROJECT_DIR$/www/protected/views/programs/index.php" /> <option value="$PROJECT_DIR$/www/protected/views/programs/index.php" />
<option value="$PROJECT_DIR$/www/protected/controllers/ProgramsController.php" /> <option value="$PROJECT_DIR$/www/protected/controllers/ProgramsController.php" />
<option value="$PROJECT_DIR$/www/css/styles.css" /> <option value="$PROJECT_DIR$/www/css/styles.css" />
<option value="$PROJECT_DIR$/www/protected/views/programs/view.php" />
<option value="$PROJECT_DIR$/www/protected/models/Program.php" />
<option value="$PROJECT_DIR$/www/data/programs/.gitignore" /> <option value="$PROJECT_DIR$/www/data/programs/.gitignore" />
<option value="$PROJECT_DIR$/www/protected/models/Program.php" />
<option value="$PROJECT_DIR$/www/protected/models/ProgramUpdatesLog.php" />
<option value="$PROJECT_DIR$/www/protected/models/ProgramUpdates.php" />
<option value="$PROJECT_DIR$/www/protected/views/programs/view.php" />
</list> </list>
</option> </option>
</component> </component>
@ -524,7 +497,33 @@
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" /> <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT> </PATH_ELEMENT>
<PATH_ELEMENT> <PATH_ELEMENT>
<option name="myItemId" value="components" /> <option name="myItemId" value="config" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT>
</PATH>
<PATH>
<PATH_ELEMENT>
<option name="myItemId" value="www.mikescher.de" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
<option name="myItemId" value="www.mikescher.de" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
<option name="myItemId" value="www" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
<option name="myItemId" value="protected" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
<option name="myItemId" value="config" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
<option name="myItemId" value="env" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" /> <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT> </PATH_ELEMENT>
</PATH> </PATH>
@ -549,62 +548,6 @@
<option name="myItemId" value="components" /> <option name="myItemId" value="components" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" /> <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT> </PATH_ELEMENT>
<PATH_ELEMENT>
<option name="myItemId" value="widgets" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT>
</PATH>
<PATH>
<PATH_ELEMENT>
<option name="myItemId" value="www.mikescher.de" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
<option name="myItemId" value="www.mikescher.de" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
<option name="myItemId" value="www" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
<option name="myItemId" value="protected" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
<option name="myItemId" value="components" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
<option name="myItemId" value="widgets" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
<option name="myItemId" value="views" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT>
</PATH>
<PATH>
<PATH_ELEMENT>
<option name="myItemId" value="www.mikescher.de" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
<option name="myItemId" value="www.mikescher.de" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
<option name="myItemId" value="www" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
<option name="myItemId" value="data" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
<option name="myItemId" value="programs" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT>
</PATH> </PATH>
<PATH> <PATH>
<PATH_ELEMENT> <PATH_ELEMENT>
@ -837,21 +780,6 @@
</breakpoint-manager> </breakpoint-manager>
</component> </component>
<component name="editorHistoryManager"> <component name="editorHistoryManager">
<entry file="file://$PROJECT_DIR$/www/protected/data/disclaimer.php">
<provider selected="true" editor-type-id="text-editor">
<state line="0" column="0" selection-start="0" selection-end="0" vertical-scroll-proportion="0.0" vertical-offset="0" max-vertical-offset="900" />
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/www/protected/config/main.php">
<provider selected="true" editor-type-id="text-editor">
<state line="34" column="56" selection-start="875" selection-end="875" vertical-scroll-proportion="0.65163475" vertical-offset="0" max-vertical-offset="1972" />
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/www/protected/data/.gitignore">
<provider selected="true" editor-type-id="text-editor">
<state line="1" column="12" selection-start="38" selection-end="38" vertical-scroll-proportion="0.031481482" vertical-offset="0" max-vertical-offset="540" />
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/www/protected/components/MsHelper.php"> <entry file="file://$PROJECT_DIR$/www/protected/components/MsHelper.php">
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
<state line="17" column="59" selection-start="390" selection-end="390" vertical-scroll-proportion="0.56007755" vertical-offset="0" max-vertical-offset="516" /> <state line="17" column="59" selection-start="390" selection-end="390" vertical-scroll-proportion="0.56007755" vertical-offset="0" max-vertical-offset="516" />
@ -1059,13 +987,6 @@
</state> </state>
</provider> </provider>
</entry> </entry>
<entry file="file://$PROJECT_DIR$/www/protected/components/widgets/views/expandedLogHeader.php">
<provider selected="true" editor-type-id="text-editor">
<state line="14" column="41" selection-start="386" selection-end="386" vertical-scroll-proportion="-9.153846" vertical-offset="0" max-vertical-offset="595">
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/www/protected/components/widgets/views/fullProgPreview.php"> <entry file="file://$PROJECT_DIR$/www/protected/components/widgets/views/fullProgPreview.php">
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
<state line="25" column="60" selection-start="549" selection-end="549" vertical-scroll-proportion="9.538462" vertical-offset="673" max-vertical-offset="1309"> <state line="25" column="60" selection-start="549" selection-end="549" vertical-scroll-proportion="9.538462" vertical-offset="673" max-vertical-offset="1309">
@ -1080,20 +1001,6 @@
</state> </state>
</provider> </provider>
</entry> </entry>
<entry file="file://$PROJECT_DIR$/www/protected/components/widgets/ExpandedLogHeader.php">
<provider selected="true" editor-type-id="text-editor">
<state line="31" column="55" selection-start="626" selection-end="639" vertical-scroll-proportion="-9.115385" vertical-offset="290" max-vertical-offset="901">
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/www/protected/controllers/ProgramsController.php">
<provider selected="true" editor-type-id="text-editor">
<state line="59" column="49" selection-start="1427" selection-end="1460" vertical-scroll-proportion="-6.8076925" vertical-offset="826" max-vertical-offset="4301">
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/www/protected/components/widgets/ThumbnailProgPreview.php"> <entry file="file://$PROJECT_DIR$/www/protected/components/widgets/ThumbnailProgPreview.php">
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
<state line="10" column="11" selection-start="227" selection-end="227" vertical-scroll-proportion="0.30141845" vertical-offset="0" max-vertical-offset="564"> <state line="10" column="11" selection-start="227" selection-end="227" vertical-scroll-proportion="0.30141845" vertical-offset="0" max-vertical-offset="564">
@ -1101,13 +1008,6 @@
</state> </state>
</provider> </provider>
</entry> </entry>
<entry file="file://$PROJECT_DIR$/www/protected/components/widgets/views/thumbnailProgPreview.php">
<provider selected="true" editor-type-id="text-editor">
<state line="63" column="64" selection-start="1675" selection-end="1675" vertical-scroll-proportion="-41.192307" vertical-offset="0" max-vertical-offset="1394">
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/framework/web/helpers/CHtml.php"> <entry file="file://$PROJECT_DIR$/framework/web/helpers/CHtml.php">
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
<state line="155" column="27" selection-start="5273" selection-end="5273" vertical-scroll-proportion="-7.5" vertical-offset="2321" max-vertical-offset="44438"> <state line="155" column="27" selection-start="5273" selection-end="5273" vertical-scroll-proportion="-7.5" vertical-offset="2321" max-vertical-offset="44438">
@ -1122,20 +1022,6 @@
</state> </state>
</provider> </provider>
</entry> </entry>
<entry file="file://$PROJECT_DIR$/www/css/styles.css">
<provider selected="true" editor-type-id="text-editor">
<state line="564" column="0" selection-start="9894" selection-end="9894" vertical-scroll-proportion="0.0" vertical-offset="9011" max-vertical-offset="9690">
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/www/protected/models/Program.php">
<provider selected="true" editor-type-id="text-editor">
<state line="205" column="24" selection-start="6462" selection-end="6462" vertical-scroll-proportion="-16.115385" vertical-offset="3066" max-vertical-offset="3638">
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/www/data/programs/.gitignore"> <entry file="file://$PROJECT_DIR$/www/data/programs/.gitignore">
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
<state line="0" column="5" selection-start="5" selection-end="5" vertical-scroll-proportion="0.0" vertical-offset="0" max-vertical-offset="611"> <state line="0" column="5" selection-start="5" selection-end="5" vertical-scroll-proportion="0.0" vertical-offset="0" max-vertical-offset="611">
@ -1143,9 +1029,72 @@
</state> </state>
</provider> </provider>
</entry> </entry>
<entry file="file://$PROJECT_DIR$/www/protected/controllers/ProgramsController.php">
<provider selected="true" editor-type-id="text-editor">
<state line="59" column="49" selection-start="1427" selection-end="1460" vertical-scroll-proportion="0.3025641" vertical-offset="826" max-vertical-offset="4301">
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/www/css/styles.css">
<provider selected="true" editor-type-id="text-editor">
<state line="564" column="0" selection-start="9894" selection-end="9894" vertical-scroll-proportion="0.9443535" vertical-offset="9011" max-vertical-offset="9690">
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/www/protected/components/widgets/views/expandedLogHeader.php">
<provider selected="true" editor-type-id="text-editor">
<state line="14" column="41" selection-start="386" selection-end="386" vertical-scroll-proportion="0.4068376" vertical-offset="0" max-vertical-offset="595">
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/www/protected/components/widgets/ExpandedLogHeader.php">
<provider selected="true" editor-type-id="text-editor">
<state line="31" column="55" selection-start="626" selection-end="639" vertical-scroll-proportion="0.4051282" vertical-offset="290" max-vertical-offset="901">
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/www/protected/components/widgets/views/thumbnailProgPreview.php">
<provider selected="true" editor-type-id="text-editor">
<state line="63" column="64" selection-start="1675" selection-end="1675" vertical-scroll-proportion="1.8307692" vertical-offset="0" max-vertical-offset="1394">
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/www/protected/config/env/dev.php">
<provider selected="true" editor-type-id="text-editor">
<state line="0" column="0" selection-start="0" selection-end="0" vertical-scroll-proportion="-0.52307695" vertical-offset="306" max-vertical-offset="1003">
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/www/protected/models/Program.php">
<provider selected="true" editor-type-id="text-editor">
<state line="63" column="0" selection-start="2117" selection-end="2233" vertical-scroll-proportion="-7.8461537" vertical-offset="867" max-vertical-offset="3621">
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/www/protected/models/ProgramUpdatesLog.php">
<provider selected="true" editor-type-id="text-editor">
<state line="7" column="32" selection-start="185" selection-end="197" vertical-scroll-proportion="-2.2307692" vertical-offset="61" max-vertical-offset="1836">
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/www/protected/models/ProgramUpdates.php">
<provider selected="true" editor-type-id="text-editor">
<state line="48" column="34" selection-start="1117" selection-end="1117" vertical-scroll-proportion="-13.730769" vertical-offset="459" max-vertical-offset="1853">
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/www/protected/views/programs/view.php"> <entry file="file://$PROJECT_DIR$/www/protected/views/programs/view.php">
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
<state line="129" column="48" selection-start="3207" selection-end="3207" vertical-scroll-proportion="0.36068377" vertical-offset="1982" max-vertical-offset="2669"> <state line="49" column="132" selection-start="1371" selection-end="1371" vertical-scroll-proportion="0.62222224" vertical-offset="469" max-vertical-offset="2703">
<folding /> <folding />
</state> </state>
</provider> </provider>

View File

@ -19,4 +19,33 @@ othervalues -> ms4_othervalues
updates -> ms4_updates updates -> ms4_updates
updates -> 'Name' is primary key updates -> 'Name' is primary key
updates -> Adjust 'Link' updates -> Adjust 'Link'
updates -> 'Name' Type is VARCHAR(64) updates -> 'Name' Type is VARCHAR(64)
updates -> Removed col 'Log'
updateslog -> new table
<?php
$rows=Yii::app()->db->createCommand('SELECT * FROM {{updates}}')->queryAll();
$transaction=Yii::app()->db->beginTransaction();
foreach($rows as $row) {
$prog = $row['Name'];
$log = $row['Log'];
$lines = explode('<br>', $log);
foreach ($lines as $line) {
$result = array();
preg_match('/([^ ]+)[^0-9]*([0-9\.]+)[^\(]*\((.*?)\)/', $line, $result);
if (count($result) == 4) {
$ip = trim($result[1]);
$version = trim($result[2]);
$date = DateTime::createFromFormat('d.m.Y - H:i:s', trim($result[3]));
echo $prog . ' | ' . $ip . ' | ' . $version . ' | ' . $date->format('Y-m-d H:i:s') . '<br>';
Yii::app()->db->createCommand("INSERT INTO {{updateslog}} (programname, ip, version, date) VALUES ('$prog', '$ip', '$version', '" . $date->format('Y-m-d H:i:s') . "')")->execute();
}
}
echo '<hr>';
}
$transaction->commit();
?>

View File

@ -23,6 +23,8 @@
* @property integer $uses_absCanv * @property integer $uses_absCanv
* @property string $update_identifier * @property string $update_identifier
* @property integer $highscore_gid * @property integer $highscore_gid
*
* @property ProgramUpdates $version
*/ */
class Program extends CActiveRecord class Program extends CActiveRecord
{ {
@ -58,9 +60,14 @@ class Program extends CActiveRecord
*/ */
public function relations() public function relations()
{ {
// NOTE: you may need to adjust the relation name and the related
// class name for the relations automatically generated below.
return array( return array(
'version' =>
[
self::HAS_ONE,
'ProgramUpdates',
[
'Name' => 'update_identifier'
]],
); );
} }
@ -197,12 +204,4 @@ class Program extends CActiveRecord
return $out; return $out;
} }
public function hasVersionInfo() {
return ! empty($this->update_identifier);
}
public function getVersionInfo() {
return 0; //TODO
}
} }

View File

@ -0,0 +1,103 @@
<?php
/**
* This is the model class for table "{{updates}}".
*
* The followings are the available columns in table '{{updates}}':
* @property string $Name
* @property string $Version
* @property string $Link
*
* @property ProgramUpdatesLog $log
*/
class ProgramUpdates extends CActiveRecord
{
/**
* @return string the associated database table name
*/
public function tableName()
{
return '{{updates}}';
}
/**
* @return array validation rules for model attributes.
*/
public function rules()
{
// NOTE: you should only define rules for those attributes that
// will receive user inputs.
return array(
array('Name, Version, Link', 'required'),
array('Name', 'length', 'max'=>64),
// The following rule is used by search().
array('Name, Version, Link', 'safe', 'on'=>'search'),
);
}
/**
* @return array relational rules.
*/
public function relations()
{
// NOTE: you may need to adjust the relation name and the related
// class name for the relations automatically generated below.
return array(
'log' =>
[
self::HAS_MANY,
'ProgramUpdatesLog',
[
'programname' => 'Name'
]],
);
}
/**
* @return array customized attribute labels (name=>label)
*/
public function attributeLabels()
{
return array(
'Name' => 'Name',
'Version' => 'Version',
'Link' => 'Link',
);
}
/**
* Retrieves a list of models based on the current search/filter conditions.
*
* Typical usecase:
* - Initialize the model fields with values from filter form.
* - Execute this method to get CActiveDataProvider instance which will filter
* models according to data in model fields.
* - Pass data provider to CGridView, CListView or any similar widget.
*
* @return CActiveDataProvider the data provider that can return the models
* based on the search/filter conditions.
*/
public function search()
{
$criteria=new CDbCriteria;
$criteria->compare('Name',$this->Name,true);
$criteria->compare('Version',$this->Version,true);
$criteria->compare('Link',$this->Link,true);
return new CActiveDataProvider($this, array(
'criteria'=>$criteria,
));
}
/**
* Returns the static model of the specified AR class.
* Please note that you should have this exact method in all your CActiveRecord descendants!
* @param string $className active record class name.
* @return ProgramUpdates the static model class
*/
public static function model($className=__CLASS__)
{
return parent::model($className);
}
}

View File

@ -0,0 +1,102 @@
<?php
/**
* This is the model class for table "{{updateslog}}".
*
* The followings are the available columns in table '{{updateslog}}':
* @property integer $ID
* @property string $programname
* @property string $ip
* @property string $version
* @property string $date
*/
class ProgramUpdatesLog extends CActiveRecord
{
/**
* @return string the associated database table name
*/
public function tableName()
{
return '{{updateslog}}';
}
/**
* @return array validation rules for model attributes.
*/
public function rules()
{
// NOTE: you should only define rules for those attributes that
// will receive user inputs.
return array(
array('programname, version', 'length', 'max'=>64),
array('ip', 'length', 'max'=>24),
array('date', 'safe'),
// The following rule is used by search().
array('ID, programname, ip, version, date', 'safe', 'on'=>'search'),
);
}
/**
* @return array relational rules.
*/
public function relations()
{
// NOTE: you may need to adjust the relation name and the related
// class name for the relations automatically generated below.
return array(
);
}
/**
* @return array customized attribute labels (name=>label)
*/
public function attributeLabels()
{
return array(
'ID' => 'ID',
'programname' => 'Programname',
'ip' => 'Ip',
'version' => 'Version',
'date' => 'Date',
);
}
/**
* Retrieves a list of models based on the current search/filter conditions.
*
* Typical usecase:
* - Initialize the model fields with values from filter form.
* - Execute this method to get CActiveDataProvider instance which will filter
* models according to data in model fields.
* - Pass data provider to CGridView, CListView or any similar widget.
*
* @return CActiveDataProvider the data provider that can return the models
* based on the search/filter conditions.
*/
public function search()
{
$criteria=new CDbCriteria;
$criteria->compare('ID',$this->ID);
$criteria->compare('programname',$this->programname,true);
$criteria->compare('ip',$this->ip,true);
$criteria->compare('version',$this->version,true);
$criteria->compare('date',$this->date,true);
return new CActiveDataProvider($this, array(
'criteria'=>$criteria,
));
}
/**
* Returns the static model of the specified AR class.
* Please note that you should have this exact method in all your CActiveRecord descendants!
* @param string $className active record class name.
* @return ProgramUpdatesLog the static model class
*/
public static function model($className=__CLASS__)
{
return parent::model($className);
}
}

View File

@ -44,10 +44,12 @@ if (!$model->visible && Yii::app()->user->name != 'admin') {
<td>Added:</td> <td>Added:</td>
<td><?php echo TbHtml::badge($model->getDateTime()->format('d.m.Y'), array('color' => TbHtml::BADGE_COLOR_INFO)); ?></td> <td><?php echo TbHtml::badge($model->getDateTime()->format('d.m.Y'), array('color' => TbHtml::BADGE_COLOR_INFO)); ?></td>
</tr> </tr>
<tr> <?php if ($model->version != null): ?>
<td>Version:</td> <tr>
<td><?php echo TbHtml::badge('????', array('color' => TbHtml::BADGE_COLOR_INFO)); ?></td> <td>Version:</td>
</tr> <td><?php echo TbHtml::badge($model->version->Version, array('color' => TbHtml::BADGE_COLOR_INFO)); ?></td>
</tr>
<?php endif ?>
</table> </table>
</div> </div>