Esempio n. 1
0
 public function func()
 {
     $b = new BBB();
     $c = new CCC();
     $i = 34;
     $item = array('foo' => 'bar');
     try {
         $c->process($b->xyz($item['foo'], $i));
     } catch (ABCException $e) {
         $b->xyz($item['foo'], $i);
     }
 }
 /**
  * HHH -> hasOneBelongsTo -> AAA -> hasOne -> BBB -> hasOne GGG (gggMember and gggMember2)
  * @depends testHasOneBelongsToHasOneToHasOne
  */
 public function testHasOneBelongsToHasOneToHasOneWithMultipleClauses()
 {
     $quote = DatabaseCompatibilityUtil::getQuote();
     $searchAttributeData = array();
     $searchAttributeData['clauses'] = array(1 => array('attributeName' => 'aaa', 'relatedModelData' => array('attributeName' => 'bbb', 'relatedModelData' => array('attributeName' => 'ggg', 'relatedModelData' => array('attributeName' => 'gggMember', 'operatorType' => 'equals', 'value' => 'somevalue')))), 2 => array('attributeName' => 'aaa', 'relatedModelData' => array('attributeName' => 'bbb', 'relatedModelData' => array('attributeName' => 'ggg', 'relatedModelData' => array('attributeName' => 'gggMember2', 'operatorType' => 'equals', 'value' => 'somevalue')))));
     //Build the query 'where' and 'joins'. Confirm they are as expected
     $searchAttributeData['structure'] = '1 and 2';
     //Build the query 'where' and 'joins'. Confirm they are as expected
     $joinTablesAdapter = new RedBeanModelJoinTablesQueryAdapter('HHH');
     $where = ModelDataProviderUtil::makeWhere('HHH', $searchAttributeData, $joinTablesAdapter);
     $compareWhere = "({$quote}ggg{$quote}.{$quote}gggmember{$quote} = 'somevalue') and ";
     $compareWhere .= "({$quote}ggg{$quote}.{$quote}gggmember2{$quote} = 'somevalue')";
     $this->assertEquals($compareWhere, $where);
     $this->assertEquals(0, $joinTablesAdapter->getFromTableJoinCount());
     $this->assertEquals(3, $joinTablesAdapter->getLeftTableJoinCount());
     $leftTables = $joinTablesAdapter->getLeftTablesAndAliases();
     $this->assertEquals('aaa', $leftTables[0]['tableName']);
     $this->assertEquals('bbb', $leftTables[1]['tableName']);
     $this->assertEquals('ggg', $leftTables[2]['tableName']);
     //Stringing together some hasMany relations, so we need to select distinct.
     $this->assertFalse($joinTablesAdapter->getSelectDistinct());
     //Now test that the subsetSQL query produced is correct.
     $subsetSql = CCC::makeSubsetOrCountSqlQuery('hhh', $joinTablesAdapter, 1, 5, $where, null, false, $joinTablesAdapter->getSelectDistinct());
     $compareSubsetSql = "select {$quote}hhh{$quote}.{$quote}id{$quote} id ";
     $compareSubsetSql .= "from {$quote}hhh{$quote} ";
     $compareSubsetSql .= "left join {$quote}aaa{$quote} on ";
     $compareSubsetSql .= "{$quote}aaa{$quote}.{$quote}hhh_id{$quote} = {$quote}hhh{$quote}.{$quote}id{$quote} ";
     $compareSubsetSql .= "left join {$quote}bbb{$quote} on ";
     $compareSubsetSql .= "{$quote}bbb{$quote}.{$quote}id{$quote} = {$quote}aaa{$quote}.{$quote}bbb_id{$quote} ";
     $compareSubsetSql .= "left join {$quote}ggg{$quote} on ";
     $compareSubsetSql .= "{$quote}ggg{$quote}.{$quote}id{$quote} = {$quote}bbb{$quote}.{$quote}ggg_id{$quote} ";
     $compareSubsetSql .= "where " . $compareWhere . ' ';
     $compareSubsetSql .= 'limit 5 offset 1';
     $this->assertEquals($compareSubsetSql, $subsetSql);
     //Make sure the sql runs properly.
     $data = HHH::getSubset($joinTablesAdapter, 0, 5, $where, null, null, $joinTablesAdapter->getSelectDistinct());
 }
Esempio n. 3
0
            echo "<tr>";
            echo "<th>" . $row . "</th>";
            for ($col = 0; $col < $max_cols; $col++) {
                $cellId = chr(0x41 + $col) . $row;
                echo "<td width=100 class='cell'>";
                echo "<form id='form_{$cellId}' action='" . Root::i()->getVar('wroot') . "?Act=saveCell&sheet={$sheet}&cell_id={$cellId}' method='POST' onSubmit='return false;' style='margin:0; padding:0;'>";
                $input_source = preg_replace("/\"/", "&quot;", MyExcel::getCellSource($sheet, $cellId));
                //echo "<input name='content' class='cellinput' title='$cellId' type='text' value=\"".$input_source."\" id='$cellId' onkeypress='inputKeyPress(this, event)'>";
                echo "<textarea rows='10' cols='40' name='content' class='cellinput' title='{$cellId}' type='text' id='{$cellId}' onkeypress='inputKeyPress(this, event)'>" . $input_source . "</textarea>";
                echo "</form>";
                echo "<div onclick='onCellClick(\"{$cellId}\")' id='{$cellId}_value' style='min-height:20px;white-space: nowrap;'>" . MyExcel::getCellValue($sheet, $cellId) . "</div>";
                echo "</td>";
            }
            echo "</tr>";
        }
        echo "</table>";
    }
    function saveCell()
    {
        $sheet = get_current_sheet();
        $cell_id = $this->_get("cell_id");
        $new_content = $this->_post("content");
        $new_content = stripslashes($new_content);
        //$new_content = iconv('utf-8','windows-1251',$new_content);
        $new_content = trim($new_content);
        MyExcel::setCellSource($sheet, $cell_id, $new_content);
        echo MyExcel::getCellValue($sheet, $cell_id);
    }
}
$c = new CCC();
$c->_bind();